Skip to main content

Icon Button

<gstock-icon-button> | GstockIconButton

API

Properties

Name Description Reflects Type Default
color The color of the icon button. Reflects 'brand' | 'neutral' | 'information' | 'success' | 'warning' | 'danger' 'brand'
disabled Disables the button. Reflects boolean false
download Tells the browser to download the linked file as this filename. Only used when href is set. string | undefined -
href When set, the underlying button will be rendered as an <a> with this href instead of a <button>. string | undefined -
label A description that gets read by assistive devices. For optimal accessibility, you should always include a label that describes what the icon button does. string -
icon The icon of a registered custom icon library. string | undefined -
size The icon button’s size. Reflects 'small' | 'medium' | 'large' 'medium'
src An external URL of an SVG file. Be sure you trust the content you are including, as it will be executed as code and can result in XSS attacks. string | undefined -
target Tells the browser where to open the link. Only used when href is set. '_blank' | '_parent' | '_self' | '_top' | undefined -
variant The variant of the button. Reflects 'outlined' | 'plain' | 'solid' 'solid'
updateComplete

A read-only promise that resolves when the component has finished updating.

Learn more about attributes and properties .

Events

Name React Event Description Event Detail
gstock-blur-event onGstockBlurEvent Emitted when the icon button loses focus. -
gstock-focus-event onGstockFocusEvent Emitted when the icon button gains focus. -

Learn more about events .

Slots

Name Description
default The icon button’s content.

Learn more about slots .

Methods

Name Description
click( ) Simulates a click on the icon button.
focus(
options: FocusOptions
)
Sets focus on the icon button.
blur( ) Removes focus from the icon button.

Learn more about methods .

CSS Parts

Name Description
base The component’s base wrapper.

Learn more about CSS parts .

Dependencies

This component automatically imports the following dependencies.