Icon Sprite

Renders an icon using an SVG sprite.

Read more Read less

Usage

Render an icon with visually hidden text:

<.icon name="arrow-left" text="Go back" />

To display the text visibly:

<.icon name="arrow-left" text="Go back" text_position={:right} />
Attribute Type Documentation Default Value
class :any Any additional classes to be added. Variations of the component should be expressed via modifier attributes, and it is preferable to use styles on the parent container to arrange components on the page, but if you have to, you can use this attribute to pass additional utility classes to the component. The value can be a string or a list of strings. []
Required name * :string Icon name as used in the sprite.
rest :global Any additional HTML attributes.
text :string Text that describes the icon.
text_position :string Position of the text relative to the icon. If set to `"hidden"`, the `text` is visually hidden, but still accessible to screen readers. "hidden"