Components General

IconButton

An icon-only button with an accessible label; pressed makes it a toggle.

import { IconButton } from '@kition/tessera-ui'
Playground

Props

What is shown
import { IconButton } from '@kition/tessera-ui'
import { LayersIcon } from '@kition/tessera-icons/react'

<IconButton label="Layers" icon={LayersIcon} />

When to use

  • Toolbars, tool rails, panel headers.

When not to

  • An action whose icon is not obvious: use a Button with a label.

Examples

Toggles in a bar
icon-button.tsx
import { useState } from 'react'
import { IconButton } from '@kition/tessera-ui'
import { BoldIcon, ItalicIcon, UnderlineIcon } from '@kition/tessera-icons/react'

export default function Demo() {
  const [bold, setBold] = useState(true)
  return (
    <div className="demo-row">
      <IconButton icon={BoldIcon} label="Bold" pressed={bold} onClick={() => setBold(!bold)} />
      <IconButton icon={ItalicIcon} label="Italic" />
      <IconButton icon={UnderlineIcon} label="Underline" disabled />
    </div>
  )
}

Props

IconButton

PropTypeDefaultDescription
iconrequiredIconComponent—
labelrequiredstring—
pressedboolean—

Also takes the attributes of its HTML element (`className`, `aria-*`, events…).

Used in

12 of Kition's 16 kits use this component.

  • Board
  • Cad
  • Cube
  • Design
  • Doc
  • Effect
  • Film
  • Pdf
  • Photo
  • Sheet
  • Slide
  • Vector