Shadwire

Search the documentation

Search the documentation and component pages by title and by content.

Get started
Introduction
Installation
shadwire.json
Theming
Dark mode
Tools
CLI
Agent skill
Registry
llms.txt
Guides
Composition
Styling
Forms
Icons
Accessibility
Localisation
Blocks
Overview
Components
Overview
Accordion
Alert
Alert Dialog
Aspect Ratio
Avatar
Badge
Breadcrumb
Button
Button Group
Calendar
Card
Carousel
Chart
Checkbox
Collapsible
Combobox
Command
Context Menu
Data Table
Date Picker
Dialog
Drawer
Dropdown Menu
Empty
Field
Hover Card
Icon
Input
Input Group
Input OTP
Item
Kbd
Label
Menubar
Native Select
Navigation Menu
Pagination
Popover
Progress
Radio Group
Resizable
Scroll Area
Select
Separator
Sheet
Sidebar
Skeleton
Slider
Sonner
Spinner
Switch
Table
Tabs
Textarea
Toggle
Toggle Group
Tooltip

Icon

A wrapper around lucide-rails with shadcn sizes and accessible semantics.

Installation

Shadwire follows shadcn/ui's open code model: the component's source is copied into your application and becomes yours. Install it with the CLI:

shadwire add icon --yes

The icon registry item installs these files:

  • app/components/ui_component.rb
  • app/components/ui/icon_component.rb
  • app/helpers/ui/icon_helper.rb
  • vendor/shadwire/shadwire.css

Haven't installed the CLI yet? gem install shadwire, then shadwire init.

Usage

Names use Lucide's kebab-case, such as "chevron-down".

<%= ui_icon("download") %>
<%= ui_icon("bell", label: "Notifications") %>

Or render Ui::IconComponent directly:

<%= render Ui::IconComponent.new("download", size: :lg) %>

Examples

Decorative and labelled

Icons are decorative by default; pass label: when the icon carries meaning.

<div class="flex items-center gap-4">
  <%= ui_icon("download") %>
  <%= ui_icon("bell", label: "Notifications") %>
  <%= ui_button(variant: :outline, size: :sm) do %>
    <%= ui_icon("mail") %>
    Message
  <% end %>
  <%= ui_button(size: :icon, variant: :secondary) do %>

API reference

ui_icon(name, **options) wraps Ui::IconComponent.new(name, **options).

Argument Type Default Description
nameStringRequiredThe Lucide icon name, in kebab-case.
sizeSymbol/String:default:sm, :default, :lg or :xl.
labelStringnilWhen present, exposes the SVG with role="img" and aria-label.
**attrsHash{}Free-form HTML attributes for the SVG.