Meridianby Commenda
Components

IconButton

An action shown only as an icon, with a tooltip.

An action shown only as an icon: a square Button with the same variants, colors, focus ring and motion. Heights match Button so rows line up. Its label is required and shows as a tooltip.

tertiary
secondary
primary
tertiary · destructive
secondary · destructive
primary · destructive

Usage

Example.tsx
import { IconButton } from "@commenda/meridian/ui/icon-button";
import { DotsHorizontalIcon } from "@commenda/pathfinder/icons/DotsHorizontalIcon";

<IconButton label="More actions">
  <DotsHorizontalIcon />
</IconButton>;

Variants

Tertiary for the quiet, repeated actions most icon buttons are. Secondary when the control needs an edge. Primary only for the one main icon action, like Send.

tertiary
secondary
primary
tertiary · destructive
secondary · destructive
primary · destructive

Sizes

sm to lg match Button heights. xs 24 lives only inside another control: clearing an input, closing a tag.

xs · 24
sm · 28
md · 32
lg · 36

States

Hover and pressed come from the pointer, focus from the keyboard only. Open holds the hover look while its menu is up.

tertiary · default
Nothing to show yetdisabled
secondary · default
Nothing to show yetdisabled
primary · default
Nothing to show yetdisabled

Hover, press and Tab to see the other states. Every button shows its label as a tooltip.

Common uses

The jobs IconButton does on the site, at the size and variant each one takes.

More
Remove a row
Close, clear
Previous
Next
Toggle a panel
Send

Anatomy

A square container and one centered icon. The icon is 16 at xs to md and 20 at lg, and takes the variant color.

PartValue
Containerxs 24 · sm 28 · md 32 (control/md) · lg 36
Radius8 (radius/md)
Icon16 at xs–md, 20 at lg

API reference

PropTypeDescription
labelRequiredstringFrom Pathfinder.
childrenRequiredReactElement<unknown, string | JSXElementConstructor<any>>From Pathfinder.
classNamestringFrom Pathfinder.
size"md" | "lg" | "xs" | "sm"From Pathfinder.
disabledReasonstringFrom Pathfinder.
tooltipbooleanDisable the automatic hint when an explicit Tooltip wraps this control.
styleCSSProperties | ((state: ButtonState) => CSSProperties | undefined)Style applied to the element, or a function that returns a style object based on the component's state.
focusableWhenDisabledbooleanWhether the button should be focusable when disabled.
nativeButtonbooleanWhether the component renders a native <button> element when replacing it via the render prop. Set to false if the rendered element is not a button (for example, <div>).
renderReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, ButtonState>Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.
variantConditional"primary" | "secondary" | "tertiary" | "plain"From Pathfinder.
destructiveboolean | falseFrom Pathfinder.

Best practices

  • Use it for actions people know by their icon: the more menu, close, remove, previous and next on a carousel, panel toggles. Primary is only for the one main icon action, like Send.
  • If people would not recognize the icon without words, use a Button with a left icon instead.
  • The label is required. It names the action and its target ("Close the demo form"), not the icon ("X"), and the tooltip repeats it.
  • Match heights in a row: an md IconButton beside md Buttons, an lg beside lg.
  • xs 24 only inside another control. On phones use md or lg; 24 and 28 are below the touch target.
  • Source: Pathfinder IconButton. Meridian keeps it as is.

On this page