InlineCode
tsx
import { InlineCode } from "@cherry-design-system/react";
export function Hint() {
return (
<p>
Call <InlineCode>useColorMode()</InlineCode> to read the mode.
</p>
);
}InlineCode marks a short piece of code inside a sentence, such as a function name or a prop value. For a multi-line listing, use CodeBlock; for a copyable command, use Snippet.
Examples
In a table cell
tsx
import { InlineCode, Table } from "@cherry-design-system/react";
export function PropsTable() {
return (
<Table>
<thead>
<tr>
<th>Prop</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<tr>
<td><InlineCode>size</InlineCode></td>
<td><InlineCode>"md"</InlineCode></td>
</tr>
</tbody>
</Table>
);
}Properties
InlineCode has no props of its own. It renders a <code> element, forwards its ref to it and passes every native attribute through. It has no client JavaScript, so it is safe in Server Components.
Inside Prose, plain <code> elements are already styled, so InlineCode is only needed outside it.
Styling
| Hook | Values |
|---|---|
.cherry-inline-code | Root element |
The chip reads --cherry-bg-subtle, --cherry-border-default, --cherry-fg-default, --cherry-radius-xs and --cherry-font-mono.
Accessibility
A plain <code> element: screen readers read its text as part of the sentence.