Skip to content

IconButton

import { IconButton } from 'yarcl';

An IconButton is as wide as it is tall, so it lines up with a Button or Input of the same size.

<IconButton aria-label="Search" variant="outline">
<SearchIcon />
</IconButton>
  • aria-label is required by the types: without visible text, it’s the button’s only name.
  • Pair it with a Tooltip so sighted users can see the label too.
  • loading swaps the icon for a Spinner and disables the button.

Accepts every native <button> attribute except color.

PropTypeDefaultDescription
aria-label requiredstringAccessible name, announced by screen readers in place of visible text.
colorColorconfigconfig.defaults.colorSemantic color, from the colors config.
loadingbooleanShows a Spinner, disables the button and sets aria-busy.
radius'size' | Radiusconfigconfig.defaults.radiusBorder radius, from the radii config, or 'size' for the radius named like the control's size.
sizeSizeconfigconfig.defaults.sizeControl size, from the sizes config.
variantVariantconfigconfig.defaults.variantStyle recipe, from the variants config.