Richtext Icons
A purpose-built icon set for editorial and prose UIs. Seven HTTP method glyphs, a strong-leading marker, a list bullet, four prose arrows, a blockquote opening mark, and an external-link arrow. Pass name="method-get" (or any other registered name) and the matching SVG renders inline.
method-get
method-post
method-put
method-patch
method-delete
method-head
method-options
strong-marker
list-bullet
arrow-right
arrow-left
arrow-double-right
arrow-double-left
blockquote
external-link
Customize
Icon set
24px
fg
Installation
npx shadcn@latest add https://craftbits.dev/r/richtext-icons.jsonUsage
import { RichtextIcon } from "@craft-bits/core";
<RichtextIcon name="method-get" size={16} />Understanding the component
- One inline SVG per icon.
RichtextIconrenders one<svg>and switches both the inner body and the intrinsicviewBoxbased onname. Wide arrows, squat blockquotes, and square method glyphs all keep their natural silhouettes. - Aspect-aware sizing.
sizeis the height in pixels; the width is derived from the icon's intrinsic aspect ratio so glyphs never get squashed when dropped into rows of mixed icons. currentColorstrokes and fills. Every glyph paints withcurrentColor, so colouring is just settingcoloron the parent (or passingaccentColorfor a one-off override).RICHTEXT_ICONSmap for iteration. The full glyph table is exported so legends, toolbars, and sidebars can iterate the set without re-listing names.
Variants / Examples
// Tint via parent color.
<span className="text-cb-accent">
<RichtextIcon name="strong-marker" size={20} />
</span>
// One-off accent without a wrapping span.
<RichtextIcon name="arrow-right" accentColor="#6366f1" size={18} />
// Iterate the full set.
import { RICHTEXT_ICON_NAMES } from "@craft-bits/core";
{RICHTEXT_ICON_NAMES.map((n) => <RichtextIcon key={n} name={n} />)}Props
| Prop | Type | Default | Description |
|---|---|---|---|
name | RichtextIconName | required | Which glyph to render. See the demo above for the full set. |
size | number | 16 | Pixel height. Width is derived from the glyph's aspect ratio. |
accentColor | string | — | Optional override for the icon color (sets inline style.color). |
className | string | — | Extra classes merged onto the <svg>. |
Accessibility
- Each glyph is decorative (
aria-hidden="true") by default. If the icon carries meaning on its own — e.g. a method label in a list — pair it with a visible text label or override with anaria-labelon the consuming element. - Strokes and fills use
currentColorand the defaultfillisnone, so contrast tracks the parent text color and inherits anyprefers-contrastoverrides applied site-wide.
Credits
- Extracted from:
terminal-dreams(src/components/ui/richtext-icons.tsx).