Button

The button component is a component that triggers an action when clicked. It can be used to submit forms, navigate to a new page, or trigger any other action that can be handled by JavaScript.

Design system docs

Examples Variants

The button component comes in three variants: default (primary), outline, and subtle. The default variant is used for primary actions, the outline variant is used for secondary actions, and the subtle variant is used for tertiary actions.

<dap-ds-stack direction="row">
<dap-ds-button>
  Login
</dap-ds-button>

<dap-ds-button variant="outline">
  Login
</dap-ds-button>

<dap-ds-button variant="subtle">
  Login
</dap-ds-button>
</dap-ds-stack>
Shape

The button component comes in two shapes: button (rounded), and circle. The default shape is used for most buttons, and the circle shape is used for buttons that need to stand out.

<dap-ds-stack direction="row">
<dap-ds-button>
  <dap-ds-icon name="close-line"></dap-ds-icon>
</dap-ds-button>

<dap-ds-button shape="circle">
  <dap-ds-icon name="close-line"></dap-ds-icon>
</dap-ds-button>
</dap-ds-stack>
Sizes

The button component comes in three sizes: small, medium, and large. The small size is used for buttons in tight spaces, the medium size is used for most buttons, and the large size is used for buttons that need to stand out.

<dap-ds-stack direction="row">
<dap-ds-button size="xs">
  Login
</dap-ds-button>

<dap-ds-button size="sm">
  Login
</dap-ds-button>

<dap-ds-button>
  Login
</dap-ds-button>

<dap-ds-button size="lg">
  Login
</dap-ds-button>
</dap-ds-stack>
Icon position

The button component can have an icon on the left or right side of the text.

<dap-ds-stack direction="row">
<dap-ds-button>
  <dap-ds-stack direction="row">
    <dap-ds-icon name="close-line"></dap-ds-icon>
    <span>Bezár</span>
  </dap-ds-stack>
</dap-ds-button>

<dap-ds-button>
  <dap-ds-stack direction="row-reverse">
    <dap-ds-icon name="close-line"></dap-ds-icon>
    <span>Bezár</span>
  </dap-ds-stack>
</dap-ds-button>

<dap-ds-button>
  <dap-ds-icon name="close-line"></dap-ds-icon>
</dap-ds-button>
</dap-ds-stack>
Statuses

The button component can have a status of loading, danger, or disabled.

<dap-ds-stack direction="row">
<dap-ds-button loading>
  Login
</dap-ds-button>

<dap-ds-button danger>
  Login
</dap-ds-button>

<dap-ds-button disabled>
  Login
</dap-ds-button>
</dap-ds-stack>
As link

The button component can be used as a link by providing an href attribute. It will render an anchor tag instead of a button.

<dap-ds-button href="https://services.gov.hu">
Services
</dap-ds-button>
Importing
import { DapDSButton } from 'dap-design-system/dist/dds'
Importing React
import { DapDSButtonReact } from 'dap-design-system/dist/react'
Attributes
PropertyTypeDefaultDescription
variant'primary', 'outline' , 'subtle' , 'clean''primary'The variant of the button
size'lg', 'md' , 'sm' , 'xs''md'The size of the button
loadingbooleanfalseWhether the button is in loading state
dangerbooleanfalseWhether the button is danger button
shape'button', 'circle''button'The shape of the button
htmlType'button', 'submit' , 'reset''button'The html type of the button
namestringThe name of the button
hrefstringThe Href of the button. If this present the button will be rendered as an anchor <a></a> element.
target'_blank', '_self' , '_parent' , '_top''_self'The target of the button
relstring'noreferrer noopener'The rel of the button link. Default is noreferrer noopener.
Slots
NameDescription
(default)The content of the button.
Events

No custom events available.

CSS Parts
Part NameDescription
baseThe main button container.
high-contrastThe high contrast part of the button.