Skip to content

Button - Web Component

The Button component can be used imported from:

Playground

Parameters

The Web component uses the <z-button> tag:

By default, all the parameters are optional or can be set in different, except for the ones marked as required

The parametrization of the component can be done with the following custom HTML params:

NameTypeDescriptionSlotA11y
configstring

The main parameter has three components following the pattern: <type><?:size><?:round>

  • type: defines the type of button that is going to be shown up. The possible values are: primary, secondary, positive, negative, and link.
  • size: (optional) defines de size of the button. The default value is m, being omitted from the param. The possible values are: xs, s, or l. Check the sizes section.
  • round: (optional) if we define the value round, the button will take a round shape.
iconstring

The name of the icon that will be shown up inside the button. Check the icon list

contentstringThe text that will be shown up inside the button.default
icon-rightboolean

Defines the position of the icon. The default value is true, being omitted.

disabledbooleanBlocks the interaction with the component.
loadingbooleanShows a loading animation inside the button.
widebooleanExpands the button to the full width of its parent.

Events

This component has events. Check the documentation about how to use the events.

NamePayloadDescription
clickMouseEvent...

Slots

This component has slots. Check the documentation about how to use the slots.

NameTagsDescription
defaultspanContent of the button.

Parameters use

Check the documentation about how to use the parameters.

content

The text or content inside the button. It uses the default slot too.

Button

config

type

The z-button component will use the primary type as default, matching the primary type of the specifications.

Button

There are four more types of buttons, secondary, negative, positive, and link

ButtonButtonButtonButton
size

The first modifier is size defines the size of the button. The value is m, being omitted from the parameter. The possible values for size are: xs, s or l. Check the size section.

ButtonButtonButtonButton
round

The second modifier is round, that can receive the value round to implement a round styling to the button.

BTN

This configuration is also applied by default if the button doesn't have text. For example, only having an icon:

TIP

Make sure the content of the round button it's short and concise. Best approach would be to use a simple call to action icon

icon

The attribute icon it's useful to insert a specific CTA icon. Check the icon list here. This attribute will receive the name of the icon to be show. You can use both solid or line (outlined) version.

Button

icon-right

This attribute will display the icon on the right side of the text.

Button

disabled

The attribute disabled will block the interaction with the component.

Button

loading

A loading indicator can be added to a button by setting the loading attribute.

Button

wide

The wide attribute will make the button take the full width of the parent container.

Button

Button can directly be used as links. Just provide a href attribute.

Button

Browser support

Detected engine:  

  • Chromium

  • Webkit

  • Gecko

HTML Examples

CodeSandbox example