Icons SVG icons placed next to text in buttons, links, and breadcrumbs. For an animated chevron, use ChevronToArrow or the Expand chevron .
Installation bun add @harmo-ui/css @harmo-ui/react npm install @harmo-ui/css @harmo-ui/react pnpm add @harmo-ui/css @harmo-ui/react yarn add @harmo-ui/css @harmo-ui/react bunx harmo-ui add chevron pnpm dlx harmo-ui add chevron yarn dlx harmo-ui add chevron Usage import { Chevron , Link } from "@harmo-ui/react" ;
< Link href = "/settings" >
Settings
< Chevron />
</ Link > Examples Static chevron The chevron is drawn in the middle third of its box. .hchevron pulls it in so the gap to the text matches other icons: the first link has the class, and the second, without it, leaves a wider gap.
<>
< Link href = "/settings" >
Settings
< Chevron />
</ Link >
< Link href = "/settings" >
Settings
< ChevronIcon className = "hicon" />
</ Link >
</> < a class = "hlink" href = "/settings" >
Settings
< svg class = "hicon hchevron" width = "1.125em" height = "1.125em" viewBox = "0 0 24 24" fill = "none" aria-hidden = "true" focusable = "false" >
< path
d = "M8.79048 5C8.58956 5 8.38863 5.07186 8.23001 5.22585C7.92333 5.52355 7.92333 6.01631 8.23001 6.31402L14.0886 12.0013L8.23001 17.6885C7.92333 17.9863 7.92333 18.479 8.23001 18.7767C8.53668 19.0744 9.04428 19.0744 9.35096 18.7767L15.77 12.5454C16.0767 12.2477 16.0767 11.7549 15.77 11.4572L9.35096 5.22585C9.19233 5.07186 8.99141 5 8.79048 5Z"
fill = "currentColor"
/>
</ svg >
</ a >
< a class = "hlink" href = "/settings" >
Settings
< svg class = "hicon" width = "1.125em" height = "1.125em" viewBox = "0 0 24 24" fill = "none" aria-hidden = "true" focusable = "false" >
< path
d = "M8.79048 5C8.58956 5 8.38863 5.07186 8.23001 5.22585C7.92333 5.52355 7.92333 6.01631 8.23001 6.31402L14.0886 12.0013L8.23001 17.6885C7.92333 17.9863 7.92333 18.479 8.23001 18.7767C8.53668 19.0744 9.04428 19.0744 9.35096 18.7767L15.77 12.5454C16.0767 12.2477 16.0767 11.7549 15.77 11.4572L9.35096 5.22585C9.19233 5.07186 8.99141 5 8.79048 5Z"
fill = "currentColor"
/>
</ svg >
</ a >
View full source
Following the text Sized in em and drawn in currentColor, an icon takes the size and color of the text beside it. .hicon keeps it from shrinking, and aria-hidden="true" leaves the naming to the text.
<>
< Link href = "/settings" style = { { fontSize : "0.875rem" } } >
Settings
< Chevron />
</ Link >
< Link href = "/settings" >
Settings
< Chevron />
</ Link >
< Link href = "/settings" style = { { fontSize : "1.25rem" } } >
Settings
< Chevron />
</ Link >
</>
View full source
< a class = "hlink" href = "/settings" style = "font-size: 0.875rem" >
Settings
< svg class = "hicon hchevron" width = "1.125em" height = "1.125em" viewBox = "0 0 24 24" fill = "none" aria-hidden = "true" focusable = "false" >
< path
d = "M8.79048 5C8.58956 5 8.38863 5.07186 8.23001 5.22585C7.92333 5.52355 7.92333 6.01631 8.23001 6.31402L14.0886 12.0013L8.23001 17.6885C7.92333 17.9863 7.92333 18.479 8.23001 18.7767C8.53668 19.0744 9.04428 19.0744 9.35096 18.7767L15.77 12.5454C16.0767 12.2477 16.0767 11.7549 15.77 11.4572L9.35096 5.22585C9.19233 5.07186 8.99141 5 8.79048 5Z"
fill = "currentColor"
/>
</ svg >
</ a >
< a class = "hlink" href = "/settings" >
Settings
< svg class = "hicon hchevron" width = "1.125em" height = "1.125em" viewBox = "0 0 24 24" fill = "none" aria-hidden = "true" focusable = "false" >
< path
d = "M8.79048 5C8.58956 5 8.38863 5.07186 8.23001 5.22585C7.92333 5.52355 7.92333 6.01631 8.23001 6.31402L14.0886 12.0013L8.23001 17.6885C7.92333 17.9863 7.92333 18.479 8.23001 18.7767C8.53668 19.0744 9.04428 19.0744 9.35096 18.7767L15.77 12.5454C16.0767 12.2477 16.0767 11.7549 15.77 11.4572L9.35096 5.22585C9.19233 5.07186 8.99141 5 8.79048 5Z"
fill = "currentColor"
/>
</ svg >
</ a >
< a class = "hlink" href = "/settings" style = "font-size: 1.25rem" >
Settings
< svg class = "hicon hchevron" width = "1.125em" height = "1.125em" viewBox = "0 0 24 24" fill = "none" aria-hidden = "true" focusable = "false" >
< path
d = "M8.79048 5C8.58956 5 8.38863 5.07186 8.23001 5.22585C7.92333 5.52355 7.92333 6.01631 8.23001 6.31402L14.0886 12.0013L8.23001 17.6885C7.92333 17.9863 7.92333 18.479 8.23001 18.7767C8.53668 19.0744 9.04428 19.0744 9.35096 18.7767L15.77 12.5454C16.0767 12.2477 16.0767 11.7549 15.77 11.4572L9.35096 5.22585C9.19233 5.07186 8.99141 5 8.79048 5Z"
fill = "currentColor"
/>
</ svg >
</ a >
View full source
Direction The static chevron points forward, toward the end of the line. data-direction="back" points it toward the start, as for a previous-month button.
<>
< Button variant = "tertiary" aria-label = "Previous month" >
< Chevron direction = "back" />
</ Button >
< Button variant = "tertiary" aria-label = "Next month" >
< Chevron />
</ Button >
</> < button class = "hbutton" data-variant = "tertiary" type = "button" aria-label = "Previous month" >
< svg class = "hicon hchevron" data-direction = "back" width = "1.125em" height = "1.125em" viewBox = "0 0 24 24" fill = "none" aria-hidden = "true" focusable = "false" >
< path
d = "M8.79048 5C8.58956 5 8.38863 5.07186 8.23001 5.22585C7.92333 5.52355 7.92333 6.01631 8.23001 6.31402L14.0886 12.0013L8.23001 17.6885C7.92333 17.9863 7.92333 18.479 8.23001 18.7767C8.53668 19.0744 9.04428 19.0744 9.35096 18.7767L15.77 12.5454C16.0767 12.2477 16.0767 11.7549 15.77 11.4572L9.35096 5.22585C9.19233 5.07186 8.99141 5 8.79048 5Z"
fill = "currentColor"
/>
</ svg >
</ button >
< button class = "hbutton" data-variant = "tertiary" type = "button" aria-label = "Next month" >
< svg class = "hicon hchevron" width = "1.125em" height = "1.125em" viewBox = "0 0 24 24" fill = "none" aria-hidden = "true" focusable = "false" >
< path
d = "M8.79048 5C8.58956 5 8.38863 5.07186 8.23001 5.22585C7.92333 5.52355 7.92333 6.01631 8.23001 6.31402L14.0886 12.0013L8.23001 17.6885C7.92333 17.9863 7.92333 18.479 8.23001 18.7767C8.53668 19.0744 9.04428 19.0744 9.35096 18.7767L15.77 12.5454C16.0767 12.2477 16.0767 11.7549 15.77 11.4572L9.35096 5.22585C9.19233 5.07186 8.99141 5 8.79048 5Z"
fill = "currentColor"
/>
</ svg >
</ button >
View full source
Right to left The same chevrons in Arabic. Both mirror: forward points left, toward the end of the line, and back points right.
<>
< Link href = "/settings" >
الإعدادات
< Chevron />
</ Link >
< Button variant = "tertiary" aria-label = "الشهر السابق" >
< Chevron direction = "back" />
</ Button >
< Button variant = "tertiary" aria-label = "الشهر التالي" >
< Chevron />
</ Button >
</>
View full source
< a class = "hlink" href = "/settings" >
الإعدادات
< svg class = "hicon hchevron" width = "1.125em" height = "1.125em" viewBox = "0 0 24 24" fill = "none" aria-hidden = "true" focusable = "false" >
< path
d = "M8.79048 5C8.58956 5 8.38863 5.07186 8.23001 5.22585C7.92333 5.52355 7.92333 6.01631 8.23001 6.31402L14.0886 12.0013L8.23001 17.6885C7.92333 17.9863 7.92333 18.479 8.23001 18.7767C8.53668 19.0744 9.04428 19.0744 9.35096 18.7767L15.77 12.5454C16.0767 12.2477 16.0767 11.7549 15.77 11.4572L9.35096 5.22585C9.19233 5.07186 8.99141 5 8.79048 5Z"
fill = "currentColor"
/>
</ svg >
</ a >
< button class = "hbutton" data-variant = "tertiary" type = "button" aria-label = "الشهر السابق" >
< svg class = "hicon hchevron" data-direction = "back" width = "1.125em" height = "1.125em" viewBox = "0 0 24 24" fill = "none" aria-hidden = "true" focusable = "false" >
< path
d = "M8.79048 5C8.58956 5 8.38863 5.07186 8.23001 5.22585C7.92333 5.52355 7.92333 6.01631 8.23001 6.31402L14.0886 12.0013L8.23001 17.6885C7.92333 17.9863 7.92333 18.479 8.23001 18.7767C8.53668 19.0744 9.04428 19.0744 9.35096 18.7767L15.77 12.5454C16.0767 12.2477 16.0767 11.7549 15.77 11.4572L9.35096 5.22585C9.19233 5.07186 8.99141 5 8.79048 5Z"
fill = "currentColor"
/>
</ svg >
</ button >
< button class = "hbutton" data-variant = "tertiary" type = "button" aria-label = "الشهر التالي" >
< svg class = "hicon hchevron" width = "1.125em" height = "1.125em" viewBox = "0 0 24 24" fill = "none" aria-hidden = "true" focusable = "false" >
< path
d = "M8.79048 5C8.58956 5 8.38863 5.07186 8.23001 5.22585C7.92333 5.52355 7.92333 6.01631 8.23001 6.31402L14.0886 12.0013L8.23001 17.6885C7.92333 17.9863 7.92333 18.479 8.23001 18.7767C8.53668 19.0744 9.04428 19.0744 9.35096 18.7767L15.77 12.5454C16.0767 12.2477 16.0767 11.7549 15.77 11.4572L9.35096 5.22585C9.19233 5.07186 8.99141 5 8.79048 5Z"
fill = "currentColor"
/>
</ svg >
</ button >
View full source
API reference React <Chevron> draws the static chevron, with .hicon and .hchevron. Give your own icons className="hicon", aria-hidden="true", and focusable="false". Other props are the <svg>'s attributes.
HTML An <svg class="hicon">, a direct child of its button, link, or other container, with aria-hidden="true", focusable="false", and a width and height in em, unless its container sizes it. There's no icons.css: it uses the container's CSS, such as button.css or link.css, and chevron.css for .hchevron. It needs no script.
Size icons in em so they follow the text size. 1.125em puts the chevron at about cap height. Draw with fill="currentColor" or stroke="currentColor" so icons follow the text color. Breadcrumb separators use the static chevron with class="hbreadcrumb-separator hchevron".See Icons' full contract .
Accessibility Icons next to text are decorative: aria-hidden="true" and focusable="false", with the text carrying the meaning. A control with only an icon needs its own name; see Button 's icon-only buttons.