Icon Button

A square React button for icon only actions in small, default and large sizes with every Button variant. Its aria-label prop is required, so it is always named.

src/registry/ui/icon-button.tsx/r/icon-button.json

Installation#

bash
npx shadcn@latest add @minidev/icon-button

MiniDev UI is in the shadcn registry directory, so the short form works with no setup. Older CLI versions can use the full URL: npx shadcn@latest add https://ui.minidev.pro/r/icon-button.json

Usage#

tsx
import { IconButton } from "@/components/ui/icon-button"

export function Example() {
  return (
    <IconButton aria-label="Search" variant="default"><SearchIcon /></IconButton>
  )
}

API reference#

Also accepts every prop of Button props, passed through to the root element.

Dependencies#

npm

class-variance-authority

Built from

Examples#

All button components

Learn more