The icon button is used to trigger a secondary action when we want to reduced visual noise.
userTestingNext
theme.
<tk-icon-button
size="medium"
status="ready"
type="contained"
variant="standard"
round="false"
>
<tk-icon name="close"></tk-icon>
</tk-icon-button>
The icon you wish to use as a button is slotted inside of tk-icon-button
.
<tk-icon-button size="xs">
<tk-icon size="xs" name="close"></tk-icon>
</tk-icon-button>
<tk-icon-button size="small">
<tk-icon size="small" name="close"></tk-icon>
</tk-icon-button>
<tk-icon-button size="compact">
<tk-icon name="close"></tk-icon>
</tk-icon-button>
<tk-icon-button size="medium">
<tk-icon name="close"></tk-icon>
</tk-icon-button>
<tk-icon-button size="large">
<tk-icon name="close"></tk-icon>
</tk-icon-button>
Pass the size
prop to control the size of the button. medium
is the default.
<tk-icon-button>
<tk-icon name="close"></tk-icon>
</tk-icon-button>
<tk-icon-button type="outline">
<tk-icon name="close"></tk-icon>
</tk-icon-button>
<tk-icon-button type="ghost">
<tk-icon name="close"></tk-icon>
</tk-icon-button>
Pass the type
prop to control the type of button. contained
is the default.
<tk-icon-button variant="standard">
<tk-icon name="close"></tk-icon>
</tk-icon-button>
<tk-icon-button variant="destructive">
<tk-icon name="close"></tk-icon>
</tk-icon-button>
Pass the variant
prop to control the variant of the button. standard
is the default.
<tk-icon-button status="disabled">
<tk-icon name="close"></tk-icon>
</tk-icon-button>
<tk-icon-button status="disabled" type="outline">
<tk-icon name="close"></tk-icon>
</tk-icon-button>
<tk-icon-button status="disabled" type="ghost">
<tk-icon name="close"></tk-icon>
</tk-icon-button>
<tk-icon-button status="disabled" variant="destructive">
<tk-icon name="close"></tk-icon>
</tk-icon-button>
Pass the status
prop to indicate whether it’s ready, active, or disabled. The default is ready.
<tk-icon-button status="active">
<tk-icon name="close"></tk-icon>
</tk-icon-button>
<tk-icon-button status="active" type="outline">
<tk-icon name="close"></tk-icon>
</tk-icon-button>
<tk-icon-button status="active" type="ghost">
<tk-icon name="close"></tk-icon>
</tk-icon-button>
<tk-icon-button status="active" variant="destructive">
<tk-icon name="close"></tk-icon>
</tk-icon-button>
Pass the status
prop to indicate whether it’s ready, active, or disabled. The default is ready.
<tk-icon-button round>
<tk-icon name="close"></tk-icon>
</tk-icon-button>
<tk-icon-button variant="destructive" round>
<tk-icon name="close"></tk-icon>
</tk-icon-button>
Pass the round
boolean prop to render a round button.
<div style="display: flex; background: var(--neutral-grey-800); padding: var(--s-50);">
<tk-icon-button type="ghost" color="neutral">
<tk-icon name="close"></tk-icon>
</tk-icon-button>
<tk-icon-button type="ghost" color="neutral" round>
<tk-icon name="close"></tk-icon>
</tk-icon-button>
</div>
<hr class="horizontal-rule">
<div style="display: flex;">
<tk-icon-button type="ghost" color="blue">
<tk-icon name="close"></tk-icon>
</tk-icon-button>
<tk-icon-button type="ghost" color="green">
<tk-icon name="close"></tk-icon>
</tk-icon-button>
<tk-icon-button type="ghost" color="yellow">
<tk-icon name="close"></tk-icon>
</tk-icon-button>
<tk-icon-button type="ghost" color="red">
<tk-icon name="close"></tk-icon>
</tk-icon-button>
<tk-icon-button type="ghost" color="aqua">
<tk-icon name="close"></tk-icon>
</tk-icon-button>
<tk-icon-button type="ghost" color="teal">
<tk-icon name="close"></tk-icon>
</tk-icon-button>
<tk-icon-button type="ghost" color="orange">
<tk-icon name="close"></tk-icon>
</tk-icon-button>
<tk-icon-button type="ghost" color="pink">
<tk-icon name="close"></tk-icon>
</tk-icon-button>
<tk-icon-button type="ghost" color="purple">
<tk-icon name="close"></tk-icon>
</tk-icon-button>
<tk-icon-button type="ghost" color="grey">
<tk-icon name="close"></tk-icon>
</tk-icon-button>
</div>
<hr class="horizontal-rule">
<div style="display: flex;">
<tk-icon-button type="ghost" color="blue" round>
<tk-icon name="close"></tk-icon>
</tk-icon-button>
<tk-icon-button type="ghost" color="green" round>
<tk-icon name="close"></tk-icon>
</tk-icon-button>
<tk-icon-button type="ghost" color="yellow" round>
<tk-icon name="close"></tk-icon>
</tk-icon-button>
<tk-icon-button type="ghost" color="red" round>
<tk-icon name="close"></tk-icon>
</tk-icon-button>
<tk-icon-button type="ghost" color="aqua" round>
<tk-icon name="close"></tk-icon>
</tk-icon-button>
<tk-icon-button type="ghost" color="teal" round>
<tk-icon name="close"></tk-icon>
</tk-icon-button>
<tk-icon-button type="ghost" color="orange" round>
<tk-icon name="close"></tk-icon>
</tk-icon-button>
<tk-icon-button type="ghost" color="pink" round>
<tk-icon name="close"></tk-icon>
</tk-icon-button>
<tk-icon-button type="ghost" color="purple" round>
<tk-icon name="close"></tk-icon>
</tk-icon-button>
<tk-icon-button type="ghost" color="grey" round>
<tk-icon name="close"></tk-icon>
</tk-icon-button>
</div>
Pass the round
boolean prop to render a round button.
Property | Attribute | Description | Type | Default |
---|---|---|---|---|
color |
color |
Pass the color prop to render the corresponding color on the button. Only works for buttons with type="ghost" |
"aqua" | "blue" | "green" | "grey" | "neutral" | "orange" | "pink" | "purple" | "red" | "teal" | "yellow" |
undefined |
label |
label |
Pass the label prop to render an aria-label on the button. |
string |
undefined |
round |
round |
Pass the round boolean prop to render a round button. |
boolean |
false |
size |
size |
Pass the size prop to control the size of the button. |
"compact" | "large" | "medium" | "small" | "xs" |
'medium' |
status |
status |
Pass the status prop to indicate whether the button is active (“on”), ready (“rest”), or disabled. |
"active" | "disabled" | "ready" |
'ready' |
type |
type |
Pass the type prop to control the type of button. |
"contained" | "ghost" | "outline" |
'contained' |
variant |
variant |
Pass the variant prop to control the variant of the button. |
"destructive" | "standard" |
'standard' |