Last modified: 4/Oct/2024
IconButton
Use the IconButton component for simple interactions that doesn't need labeling, like "Copy text" or format options like "Insert link". Use the nested hover tooltip to describe the action or show the shortcut.
#Usage
Note that the IconButton
needs either a tooltip
or an ariaLabel
because of accessibility reasons.
#IconButton with tooltip
import { IconButton } from '@kinsta/stratus'
const MyComponent = () => (
<>
<IconButton icon="Wrench" tooltip="This is a wrench" />
</>
)
#IconButton with aria-label
import { IconButton } from '@kinsta/stratus'
const MyComponent = () => (
<>
<IconButton icon="Wrench" ariaLabel="This is a wrench" />
</>
)
#Props
The IconButton
components interface extends the
HTMLButtonElement
interface. So you can use any props which documented there. Also, you can utilize all the React Synthetic events (on*
),
and props related to styling (className
, style
).
#size
"xs" ǀ "s" ǀ "m" ǀ "l"
#tooltip
React.ReactNode
ariaLabel
is not provided #isDisabled
boolean
#isLoading
boolean
#htmlType
"button" ǀ "submit" ǀ "reset"
#type
"primary" ǀ "secondary" ǀ "tertiary" ǀ "danger"
#Types
IconName
: visit the Icon's docs for more info.IconButtonProps
: props of theIconButtonProps
component processed by stratus.IconButtonInterface
:IconButtonProps
extended byHTMLAttributes<HTMLButtonElement >
.
Read more about types here