Section Label
The uppercase heading over a group of items in a list, menu, or panel.
Installation#
npx shadcn@latest add @formance/section-labelInstall the following dependencies:
npm install class-variance-authority radix-uiCopy and paste the following code into your project.
Update the import paths to match your project setup.
Usage#
import { SectionLabel } from '@/components/ui/section-label'<SectionLabel asChild> <h3>Getting Started</h3></SectionLabel>SectionLabel is the heading over a group of items: a filter panel section, a
detail panel section, a list of links. It is sans, uppercase, text-xs and
muted. Use asChild to give it the heading level of the page.
It has no padding. The container sets it, so the label aligns with the text of its items.
The group labels of Command, Select, DropdownMenu, ContextMenu and
Menubar use the same recipe, sectionLabelVariants. Inside these components,
use their own label slot (CommandGroup heading, SelectLabel,
DropdownMenuLabel, …), not SectionLabel: the slot keeps the style of the
component in one place, and in Command and Select it connects the label to
its group for screen readers. For content in a menu that is not a heading,
use DropdownMenuLabel variant="plain".
Eyebrow is different: it is mono and names a product area, such as
SidebarSectionLabel in the sidebar. SectionLabel names a list of items.