Skip to content
Stylhero 0.8.0
Components

Core

Layout and type

Inputs

Overlays

Navigation

Data display

Charts

Transitions and utilities

Page pieces (landing pages, portfolios, docs)

Icons

Components / Inputs

IconButton

Square button holding one Lucide icon. Pass href to render a link: internal links go through your router's link (LinkProvider), http(s):// links open in a new tab.

import { IconButton } from "@stylhero/ui";

Example

Code
import { IconButton, Stack, PlusIcon, SearchIcon, StarIcon } from "@stylhero/ui";

function IconButtonExample() {
  return (
    <Stack direction="row" gap={2}>
      <IconButton label="Add"><PlusIcon /></IconButton>
      <IconButton label="Search" variant="secondary"><SearchIcon /></IconButton>
      <IconButton label="Favorite" variant="primary"><StarIcon /></IconButton>
    </Stack>
  );
}

Props

PropTypeDefaultDescription
label required string - Required: what the button does, read by screen readers ("Delete customer").
href string -
size "sm" | "md" | "lg" "md" "lg" is 44px, the minimum comfortable tap target on phones.
variant "ghost" | "secondary" | "primary" "ghost"

Also takes every <button> attribute (id, style, data-*, aria-*, event handlers…), passed to that element. Takes a ref.

Keyboard

KeyDoes
Enter / SpaceActivates it

Accessibility

  • label is required and becomes the accessible name (aria-label), since the button has no visible text.

Generated from src/components/IconButton.tsx. Something wrong or missing? Open an issue.