Icon Button - React
import { IconButton } from '@sky-uk/ui-core';
The IconButton
provides an interactive wrapper for a Skycon for supplementary actions.
Props
src
The src
prop expects a partial SVG path
of the icon that you want to render. It is recommend to use icons from the Skycons package. See the Skycons documentation page for more information.
$appearance
We provide a light version of the IconButton
for when we need light UI to sit over a dark background or asset.
default
light
$variant
solid (default)
minimal
$size
small
medium (default)
large
States
Disabled
An IconButton
can be set to disabled
, however this should only be used when absolutely required such as inactive navigation items, see the IconButton usage page for more.
Hover and Focus
The hover and focus state can be set via $hover
and $focused
respectively to override default behaviour.
Accessibility
If you are using an IconButton
without a visual label consider adding IconButton.HiddenText
. This will support users who need screen readers by providing a visually hidden description.
<IconButton src={informationCircleLinear}><IconButton.HiddenText>Contextual Information</IconButton.HiddenText></IconButton>
System Modifiers
The IconButton
component supports the props applied using the following system modifiers: