Icon chips that spring open on hover to reveal labels.
npx shadcn@latest add @iconiq/icon-bar"use client";
import { Building2, Cloud, GraduationCap, Sun } from "lucide-react";
import { IconBar, IconBarItem } from "@/components/ui/icon-bar";
export function IconBarPreview() {
return (
<IconBar>
<IconBarItem icon={Building2} label="Office" />
<IconBarItem icon={GraduationCap} label="School" />
<IconBarItem icon={Sun} label="Sunny" />
<IconBarItem icon={Cloud} label="Cloudy" />
</IconBar>
);
}valueControlled selected item value. Pair with onValueChange for fully controlled selection.
Type string | null
defaultValueOptional initial selected item when uncontrolled. Omit to start with every chip collapsed until the user clicks one.
Type string | null
onValueChangeCalled when selection changes. Receives null when the active chip is clicked again to deselect.
Type (value: string | null) => void
classNameOptional class names applied to the outer flex container.
Type string
childrenOne or more IconBarItem elements rendered in a single row with consistent spacing.
Type React.ReactNode
iconLucide icon component rendered inside the fixed 36px icon well.
Type LucideIcon
labelShort text revealed when the chip expands. Keep labels concise so the width animation stays smooth.
Type string
valueSelection identity for this chip. Defaults to label when omitted.
Type string
onClickOptional click handler fired after selection updates.
Type (event: React.MouseEvent<HTMLButtonElement>) => void
disabledDisables interaction, hover preview, and selection.
Type boolean·Default false
classNameOptional class names merged onto the chip button.
Type string
Install the exact registry entry shown on the right when you want the component file and its declared runtime dependencies together.
Dependencies: @base-ui/react/toggle, @base-ui/react/toggle-group, motion, lucide-react.
This page documents the Base UI install only. Icon Bar uses Base UI Toggle Group and Toggle for selection.
The generated registry file is /r/icon-bar.json.
Contact
Additionally, if you find any bug or issue, feel free to raise an issue.