• CMSnpm version

    • Overview
    • ContentBuilder
    • InviteUserForm
    • LoginForm
    • RenewPasswordForm
  • UInpm version

    • Overview
    • Accordion
    • AlertBubble
    • AnnouncementBar
    • Avatar
    • AvatarFileInput
    • Badge
    • Button
    • ButtonGroup
    • ButtonList
    • Calendar
    • Checkbox
    • CheckboxButton
    • CheckboxInput
    • CheckboxList
    • Chip
    • ColorRadio
    • ColorRadioGroup
    • Combobox
    • DatePicker
    • DatePickerInput
    • DateRangePicker
    • DateRangePickerInput
    • DatetimePicker
    • DatetimePickerInput
    • Dialog
    • Dropdown
    • Dropzone
    • ErrorMessage
    • FileInput
    • FlashMessages
    • FormComponent
    • Icon
    • IconButton
    • ImageGallery
    • InfoBox
    • Input
    • Label
    • Layout
    • Lightbox
    • ListItem
    • Loader
    • Lozenge
    • Menu
    • Message
    • Modal
    • ✅ ModalDialog
    • ✅ ModalHeader
    • MultiCombobox
    • MultiSelect
    • Pagination
    • Paper
    • Popover
    • Radio
    • RadioGroup
    • RasterImage
    • Select
    • ✅ Tabs
    • TextInput
    • TextLink
    • Textarea
    • TimePicker
    • TimePickerInput
    • Toggle
    • Tooltip
    • Typography
  • Formnpm version

    • Overview
    • AvatarFileInput
    • CheckboxButton
    • CheckboxInput
    • CheckboxList
    • ColorRadioGroup
    • Combobox
    • DatePickerInput
    • DateRangePickerInput
    • DatetimePickerInput
    • Dropzone
    • FileInput
    • Form
    • FormRenderer
    • GpsInput
    • MoneyInput
    • MultiCombobox
    • MultiSelect
    • NumberInput
    • PasswordInput
    • RadioGroup
    • Select
    • TextInput
    • Textarea
    • TimePickerInput
    • Toggle
  • DataGridnpm version

    • Overview
    • DataGrid
    • DataGridCustomExample
    • ExportButton
    • FilterList
    • Filters
    • FiltersButton
    • FulltextInput
    • HiddenColumns
    • HiddenColumnsButton
    • Pagination
    • RowCounts
    • RowsPerPageSelect
    • SelectedRowsToolbar
    • TableV2
    • ToolbarControl
    • ToolbarCustoms
    • ToolbarTabs
  • Wysiwygnpm version

    • Overview
  • Resizernpm version

    • Overview
  • Routernpm version

    • Overview
  • Corenpm version

    • Overview
  • Core-Reactnpm version

    • Overview
  • Stylesnpm version

    • Overview
  • Localizenpm version

    • Overview
  • Analyticsnpm version

    • Overview
  • Datepickernpm version

    • Overview
  • Icons-generatornpm version

    • Overview
  • Smart-addressnpm version

    • Overview
  • E2Enpm version

    • Overview
  • E2E-Playwrightnpm version

    • Overview
View source on GitLab

IconButton

Icon-only button. Wraps Button and renders a single Icon with an accessible label.

When to use

Use IconButton for any icon-only control (toolbar action, close/confirm, row action, …). It is the replacement for Button's deprecated isIconButton prop, so prefer it over <Button isIconButton>.

  • For a normal button with a text label, use Button.
  • For grouped or overflowing sets of buttons, see ButtonGroup and ButtonList.

Always pass label — it becomes the icon's aria-label, which is the only accessible name an icon-only button has. There is no @uxf/form twin.

Usage

import { IconButton } from "@uxf/ui/icon-button";

// action
<IconButton iconName="user" label="User" onClick={onClick} />

// styled + as a cancel action
<IconButton
    color="negative"
    iconName="xmark"
    label="Cancel"
    onClick={handleCancel}
    size="sm"
    variant="secondary"
/>;

Props

Extends Omit<ButtonProps, "children" | "isIconButton">, so all Button props except children and isIconButton are accepted (variant, color, size, isFullWidth, isDisabled, isLoading, as, href, onClick, type, analyticsCallback, …). Forwards its ref to the underlying anchor.

Prop Type Default Description
iconName IconName — Required. Icon to render.
label string — Required. Accessible label, set as the icon's aria-label.
iconSize number — Icon size in px (passed to Icon's size).

Variants & states

variant, color and size are inherited from Button and accept the same values (each defaults to "default"):

Group Values
variant default, secondary, text
size sm, default, lg, xl
color default, positive, negative, warning, info, inverted

size also sets the square dimensions of the button (the width tracks the control height per size). Behavioural states (isLoading, isDisabled) behave as on Button.

Requirements

Import the component stylesheet once in your global CSS, together with the Button stylesheet it builds on:

@import url("@uxf/ui/css/button.css");
@import url("@uxf/ui/css/icon-button.css");

Also requires the global @uxf/ui token layer, set up once per app — see @uxf/ui setup.

Links

  • Figma
Default
Open in new tab
OnlyForE2ETests
Open in new tab