Обзор
LightIconButton состоит из IconButton с прозрачной поверхностью и небольшим размером. Укажите доступное имя и декоративное содержимое иконки.
Использование
size="xs" и имеют размер 20px.
Визуальные параметры
Сравните акцент для малого и среднего размеров, включая выбранное, загружаемое и отключенное состояния.Состояние и взаимодействие
Button отвечает за активацию с клавиатуры, поведение при отключении и загрузке, refs, нативные атрибуты и композицию рендеринга. Нативное значение по умолчанию —type="button". Используйте aria-pressed для переключателей и aria-expanded для раскрывающихся элементов. Приложение управляет этими состояниями и может задать color="accent", чтобы выделить выбранное действие. Фокус с клавиатуры использует общее кольцо фокуса.
Текст всплывающей подсказки необязателен и не заменяет доступное имя из aria-label или aria-labelledby. Задайте href для ссылки. Для маршрутизации, управляемой приложением, укажите render, nativeButton={false} и role="link".
Обновление существующих элементов управления
ИмпортируйтеLightIconButton из twenty-ui/components. Замените Icon={IconPlus} на дочерние элементы <IconPlus />, small/medium на sm/md, accent="tertiary" на emphasis="subtle", а testId на data-testid. Замените синтетические флаги active и focus семантическим состоянием и фактическим фокусом с клавиатуры.
Замените LightIconButtonGroup на ButtonGroup, используя attached={false} и явные дочерние элементы. Задайте disabled для недоступных действий, включая действия без обработчика клика. Обертки и триггеры всплывающих подсказок могут оставаться вокруг каждого дочернего элемента.
Действия строки
Используйте пассивный ListItem со слотомactions для независимых элементов управления. Передайте один LightIconButton напрямую или используйте ButtonGroup для нескольких кнопок. Каждая кнопка имеет собственное доступное имя, обработчик клика и состояние отключения. Размещайте триггеры раскрывающихся списков непосредственно вокруг кнопки.
onClick может оставаться включенной, когда ее взаимодействием управляет окружающий раскрывающийся список. Явно задайте disabled для недоступных кнопок. Размещайте независимые элементы управления рядом с активируемым ListItemButton, чтобы каждый из них сохранял собственные фокус и активацию.
Свойства
string
Accessible name describing the action. Required unless
aria-labelledby supplies the name.string
ID of the element supplying the accessible name. Can be used instead of
aria-label.ReactNode
обязательно
Icon content. Decorative and hidden from assistive technology.
string | ((state: ButtonState) => string | undefined)
CSS class applied to the element, or a function that
returns a class based on the component’s state.
"accent" | "danger" | "inherit" | "neutral" | "success"
Semantic color of the button.
inherit uses the surrounding text color for the label, icons, loader, and outline border, with translucent black interaction surfaces. It supports outline, ghost, soft, and link. Resolving solid with inherit throws, including appearance inherited from ButtonGroup and wrapper defaults.boolean
Adds a shadow and backdrop blur. Neutral outline buttons also use elevated surface colors.
"standard" | "subtle"
по умолчанию:"standard"
Standard secondary text or subtle tertiary text. Semantic colors and solid surfaces keep their own colors.
boolean
по умолчанию:"false"
Whether the button should be focusable when disabled.
string
Destination URL. Renders a native anchor when
render is omitted unless nativeButton is explicitly true. Custom renderers retain their own element contract.boolean
Shows a loading indicator and disables activation.
boolean
по умолчанию:"true"
Whether the rendered root is a native button. Defaults to true for custom renderers. The built-in
href anchor defaults to false; an explicit value takes precedence.ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, ButtonState>
Caller-supplied root element or renderer. Native attributes, handlers, event details, and refs reach the rendered root. Use
nativeButton={false} and role="link" for a custom navigation anchor. Router integration belongs to the caller.AriaRole
Role of the root element. Use
link for custom navigation renderers."round" | "square"
Square or round icon control.
"md" | "sm" | "xs"
по умолчанию:"sm"
Button size:
xs (20px), sm (24px), or md (32px).CSSProperties | ((state: ButtonState) => CSSProperties | undefined)
Style applied to the element, or a function that
returns a style object based on the component’s state.
string
Text displayed when hovering or focusing the button.
number
Delay before showing the tooltip.
number
Distance in pixels between the button and the tooltip.
"bottom" | "inline-end" | "inline-start" | "left" | "right" | "top"
Preferred placement of the tooltip relative to the button.
"ghost" | "link" | "outline" | "soft" | "solid"
по умолчанию:"ghost"
Visual treatment of the button surface.
link uses compact text styling without a filled surface or border; render composition determines native semantics.