Lucide React Styling And Accessibility
Pack:
lucide-reactSource:lucide-react/lucide-react-styling-and-accessibility/SKILL.mdUse this skill when the task is about making Lucide icons consistent across the app and keeping them accessible in actual UI.
- global styling with CSS
- app-wide defaults with
LucideProvider - sizing, color, stroke width, and non-scaling strokes
titleandaria-labelfor standalone meaningful icons- icon-only buttons and screen-reader behavior
- choosing whether an icon should stay decorative
Default path
Section titled “Default path”- Read references/styling-and-a11y.md.
- Decide whether the task needs local props, global CSS, or
LucideProvider. - Keep decorative icons hidden from assistive tech unless they convey essential meaning on their own.
- Put accessible names on the interactive wrapper, not on the icon, when the icon sits inside a button or link.
- If the task starts loading icons by name or from Lucide Lab, route to
lucide-react-dynamic-icons-and-lucide-lab.
When to deviate
Section titled “When to deviate”- Use per-icon props when only a small number of icons need overrides.
- Use
LucideProviderwhen the app wants shared defaults with occasional local overrides. - Expose the icon itself to assistive tech only when it carries meaningful standalone content.
- Move to the dynamic skill if the styling problem is actually caused by runtime icon loading or Lab usage.
Guardrails
Section titled “Guardrails”- Prefer CSS for broad icon styling when per-icon overrides are not needed.
- Use
LucideProviderwhen the app wants shared defaults but still needs per-icon prop overrides. - Do not label decorative icons just to satisfy a checklist.
- Do not place the accessible name on the icon when a button already owns that interaction.
- Keep sufficient contrast and usable hit targets for interactive icon affordances.
- adding
aria-labelto decorative icons - putting accessible names on both the icon and its interactive wrapper
- using provider-level defaults when a local one-off prop would be clearer
- forgetting contrast and hit-target size on icon-only controls
Verification checklist
Section titled “Verification checklist”- the styling choice is local props, CSS, or
LucideProviderfor a reason - decorative icons stay hidden from assistive tech
- icon-only buttons carry the accessible name on the button, not the icon
- global defaults still allow local overrides where needed
- contrast and target size are adequate for interactive usage
Quick example
Section titled “Quick example”import { LucideProvider, Search } from "lucide-react";
export function ToolbarButton() { return ( <LucideProvider value={{ size: 18, strokeWidth: 1.75 }}> <button type="button" aria-label="Search"> <Search /> </button> </LucideProvider> );}Current snapshot
Section titled “Current snapshot”- Checked against official docs on 2026-04-03
- React styling guide in scope: CSS
.lucideclass andLucideProvider - React accessibility guide in scope: icons default to
aria-hidden="true"unless explicitly labeled