Skip to content

AisIconButton ​

AisIconButton provides a clickable icon. It does this by wrapping AisIcon in a BaseButton. AisIconButton is useful for building toolbars and inline controls. Use the press and hover options to add details to the user experience.

Props ​

Icon ​

The icon prop accepts either an object imported from the FontAwesome icon packs or a string specifying one of the preloaded, core icons.

Label ​

The label prop provides a textual label for the button and is required for accessibility. It is rendered as the body of the button and is visible only to screen readers.

Size ​

size adjusts the size of the icon. Valid values are sm, md, lg, xl, 2xl, 3xl, and 4xl. md is the default value.

Disabled ​

Use the boolean disabled prop to disable an AisIconButton. You can use disabled by itself or :disabled="true".

Disabled Styles ​

Use the disabledStyles prop to customize the appearance of the disabled button. The property expects an array of Tailwind classes.

Press ​

press is a boolean prop that enables a button-press animation when the user clicks the button. press will have no effect if the button is busy.

Tooltip ​

Setting tooltip to true will render the icon button's label as a tooltip. When tooltip is false, the button's label will be set as the title attribute. The default value is false. You may set the tooltip variant by passing tooltip the variant as string. Additionally, developers can specify all tooltip options by passing tooltip an options object. See the examples below for details.

Busy ​

Use the busy prop to indicate that the icon button is busy. When the component is busy, it will not accept additional clicks. This is commonly used when @click triggers an asynchronous action and must await a response.

Click to activate the busy state.

Shadow ​

shadow adds a Tailwind drop shadow to the icon. Valid values are sm, md, lg, xl, 2xl, and none, which is the default value.

Hover ​

hover is a boolean prop that cuts the button's opacity. On hover, the opacity will raise to 100%. Icon buttons are commonly used in toolbars and line items where it is useful to take the emphasis off of those elements until the user needs them. press will have no effect if the button is busy.

keepFocus ​

keepFocus is a boolean prop. When it is true, the icon button will keep focus after a click instead of calling blur(). When true, the button will have a focus ring after a click. This allows keyboard users to click multiple times. See the @click example to see it in action.

Slots ​

default slot ​

AisIconButton's default slot (i.e. tag body) allows developers to add descriptive text to an icon button. This is a good way to create unobtrusive controls in spots that might not easily accommodate an AisButton such as at the end of a line of text or in a table cell.

The button definition includes TailwindCSS's group modifier. This allows developers to do some fun things like exposing text on hover as shown in the next example.

Events ​

@click ​

Bind to @click to handle the button's click event.

0

Styling ​

Use all the standard Tailwind CSS classes to style icon buttons. Text colors (e.g. text-success) is a good place to start.