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), secondary, and subtle. The default variant is used for primary actions, the secondary 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="secondary">
    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="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'
Slots
NameDescription
(default)The content of the button.
Attributes
PropertyTypeDefaultDescription
variantButtonVariant'primary'The type of the button. Default is primary. Can be primary, secondary, subtle, or clean.
sizeButtonSize'md'The size of the button. Default is md. Can be lg, md, or sm.
loadingbooleanfalseWhether the button is in a loading state.
dangerbooleanfalseWhether the button is a danger button.
htmlTypeHtmlButtonType'button'The type of the button. Can be button, submit, or reset. Default is button. If the button is an anchor element, this attribute will be ignored.
namestringThe name of the button.
hrefstringThe URL of the button. If this present the button will be rendered as an anchor element.
targetLinkTarget'_self'The target of the button. Default is _self. Can be _blank, _self, _parent, or _top.
relstring'noreferrer noopener'The rel of the button link. Default is noreferrer noopener.
shapeButtonShape'button'
Events

No custom events available.

CSS Parts

No CSS parts available.