Components
93 components for React and Next.js. Each page has a live example and its code, the props generated from the TypeScript source, and keyboard and screen reader notes.
npm i @stylhero/ui
Core
- ButtonButton, or a link that looks like one when you pass
href. - BadgeSmall label, e.g. "Reward ready".
- CountBadgeNumber or dot on the corner of another element (MUI's Badge).
- CardContent container with an optional title, action, media and footer.
- ChoiceCardA large, card-shaped radio or checkbox, for choices that deserve more room than a plain Radio ("1440p", "Quiet build"). It is a real <input> inside a <label>, so arrow keys, Space, forms and screen readers work like any radio or checkbox. Group radios with the same
name, inside a FieldSet with a legend. - InputText field with a label, hint and error, and optional icons or text inside it (
start,end).refpoints at the input. - TextareaMulti-line text field with a label, hint and error.
autoResizegrows it with its content, up tomaxRows. - SelectNative <select>, styled. Pass <option> elements as children.
- CheckboxNative checkbox with a label and hint.
indeterminateshows a dash for a partly checked group. - RadioGive radios in a group the same
name, or use RadioGroup. - FieldSetGroups related controls under one label (MUI's FormControl + FormLabel + FormGroup).
- RadioGroupA set of radios: pick exactly one. Arrow keys move between them (native).
refpoints at the radio that takes focus (the checked one, else the first enabled one), so form libraries can focus the group, e.g. react-hook-form'sfield.ref. - CheckboxGroupA set of checkboxes: pick any number.
refpoints at the first checkbox that can take focus ("Select all" when shown). - SwitchAn on/off setting that applies immediately. Use Checkbox for choices saved with a form.
- AlertMessage about the page or a task.
warninganddangeralerts are announced right away (role="alert"); the others are announced politely. - SpinnerLoading indicator, announced to screen readers as
label("Loading"). - AvatarPicture of a person or business. Without
srcit shows the initials ofname. - AvatarGroupOverlapping stack of avatars with a "+N" for the rest.
- TableA styled <table> in a scrolling, bordered wrapper. Write thead/tbody as usual; add
sh-numto numeric cells. - TabsTabs that switch between panels in place. Arrow keys move between tabs; only the selected tab is in the Tab order.
- DialogModal built on the native <dialog>: focus trapping, Esc to close and the backdrop come from the browser.
- ToastProviderWrap your app once (e.g. in app/layout.tsx), then call
useToast()anywhere below it, ortoast()from outside components. - SnackbarA single controlled toast (MUI's Snackbar), for when you own the open state. Use useToast() for fire-and-forget messages.
- EmptyStatePlaceholder for an empty list or search: an icon, a title, a short explanation and an action.
Layout and type
- StackFlex column (or row) with token-based gaps.
- ContainerCentered page column with a 16px gutter on phones.
- GridCSS grid with a fixed number of columns, or as many columns as fit (
minChildWidth). - DividerHorizontal or vertical separator line, with an optional label in the middle.
- PaperA plain surface: background, radius, optional border and shadow. Card adds a title and layout on top of this.
- BoxGeneric wrapper with token-based spacing and colors (MUI's Box). Prefer Stack/Grid for layout and Tailwind if you use it.
- ImageListGrid of photos: products, a business's gallery, rewards.
- MasonryCards of different heights packed into columns, Pinterest-style (MUI Lab's Masonry). Items flow top-to-bottom per column.
- TextText in one of the type styles from tokens.json. Picks a matching element (h1, p, code…) unless you pass
as. - LinkStyled text link. Renders your router's link when wrapped in <LinkProvider>.
- LinkProviderMakes every Stylhero link (Link, Breadcrumbs, SideNav, AppBar, ListItem) render your router's link. In Next.js:
<LinkProvider component={NextLink}>in app/layout.tsx.
Inputs
- IconButtonSquare button holding one Lucide icon. Pass
hrefto render a link: internal links go through your router's link (LinkProvider),http(s)://links open in a new tab. - ButtonGroupJoins secondary Buttons or IconButtons into one bar.
- ToggleGroupSegmented control. Single choice by default (a view switcher);
multiplefor independent toggles.refpoints at the button that takes focus (the first pressed one, else the first enabled one). - ChipCompact pill for filters, tags and selected values.
- SliderNative range input, styled.
- RatingStar rating. The interactive version is a radio group, so arrow keys work.
refpoints at the star that takes focus (the checked one, else the first); it is unset whenreadOnly. - ComboboxText input with a filtered list of options (MUI calls it Autocomplete).
refpoints at the text box. Withname, native forms submit the option values (not the labels). Give itloadOptionsto search a server instead of a fixed list. - NumberInputNumber field with − and + buttons (MUI Base's NumberInput). Arrow keys step; typing is clamped on blur.
- TransferListMove items between two lists, e.g. which products earn stamps.
- FabFloating action button: the one main action on a screen, e.g. "Add customer".
- SpeedDialA Fab that opens a few related actions, each with a visible label.
- CalendarMonth grid (MUI X's DateCalendar). Arrows move by day/week, PageUp/PageDown by month, Enter picks.
- DatePickerField that opens a Calendar (MUI X's DatePicker).
refpoints at the field's button. - DateRangePickerPick a start and end date (MUI X Pro's DateRangePicker).
refpoints at the field's button. - TimePickerPick a time from a list you can type to filter (MUI X's TimePicker).
refpoints at the text box. - DateTimePickerDate and time side by side, one Date value (MUI X's DateTimePicker).
refpoints at the date button.
Overlays
- TooltipShort hint on hover and keyboard focus. Not for anything the user must read: it is hidden on touch.
- PopoverSmall floating panel anchored to a trigger: quick forms, details, filters. Esc or an outside click closes it.
- MenuDropdown list of actions. Arrow keys, Home/End, typing a letter and Esc all work.
- DrawerSide panel built on the native <dialog>, like Dialog: for filters, details and mobile navigation.
- BackdropDims the whole screen, e.g. while saving. Built on native <dialog>, so it blocks clicks and traps focus.
- ModalBare modal layer for custom panels (MUI's Modal). Esc and backdrop click call onClose.
Navigation
- AppBarTop bar with logo, main links and actions. On phones (640px and narrower) the links move to their own row below the logo.
- SideNavVertical app navigation for dashboards. Put it in a Drawer on phones.
- BreadcrumbsTrail of parent pages. The last item is the current page.
- PaginationPage numbers with previous and next buttons. The current page is marked with aria-current.
- StepperProgress through a multi-step flow (sign-up, checkout).
- MobileStepperCompact stepper for phones and carousels: Back · dots · Next.
- BottomNavPhone tab bar: 3 to 5 top-level destinations.
Data display
- AccordionCollapsible sections built on native <details>, so they work without JavaScript and with find-in-page.
- ListBordered list of rows, e.g. customers or recent visits.
- ListItemRow in a List: a title and description, with optional leading and trailing content. With
hreforonClickit's a link or button. - StatA headline number for dashboards.
- SkeletonGrey placeholder shown while content loads.
- ProgressLinear progress bar.
- ProgressCircleRing progress, e.g. "7 of 10 stamps".
- TimelineEvents in order: a customer's visits, an order's status history (MUI Lab's Timeline).
- TreeViewNested, collapsible list: folders, categories, branches → stores (MUI X's Tree View). Full arrow-key support.
- DataGridTable with sorting, search, selection, pagination, column hiding and CSV export (MUI X's DataGrid). Add
virtualizefor thousands of rows.
Charts
- BarChartCompare amounts across categories (MUI X's BarChart). Hover a column for exact values.
- LineChartChange over time (MUI X's LineChart). Hover anywhere for a crosshair with every series' value.
- ScatterChartRelationship between two measures (MUI X's ScatterChart).
- PieChartParts of a whole (MUI X's PieChart). Best with 2 to 5 slices.
- SparklineTiny trend line with no axes, for tables and stat tiles (MUI X's SparkLineChart).
- GaugeOne number against a goal, as a half ring (MUI X's Gauge).
Transitions and utilities
- TransitionAnimates children in and out (MUI's Fade, Grow, Zoom, Slide and Collapse). Honors reduced motion.
- FadeFades its children in and out. Shortcut for
<Transition effect="fade">. - GrowScales and fades its children in from their origin. Shortcut for
<Transition effect="grow">. - ZoomZooms its children in from the center. Shortcut for
<Transition effect="zoom">. - SlideSlides its children in from
direction. Shortcut for<Transition effect="slide">. - CollapseExpands and collapses its children's height. Shortcut for
<Transition effect="collapse">. - PortalRenders children into document.body (or
container), outside overflow and stacking contexts. - NoSsrRenders children only in the browser, after hydration (e.g. things that read window or localStorage).
- ClickAwayListenerWraps one element and calls
onClickAwaywhen someone clicks outside it.
Page pieces (landing pages, portfolios, docs)
- TableOfContentsIn-page jump links that highlight the section in view (scroll spy), like the "On this page" list in docs.
- SkipLink"Skip to content" link for keyboard users: hidden until focused. Put it first in the page.
- SpotlightSoft glow that follows the cursor, for landing and portfolio pages. Wide screens only; off for reduced motion.