Button | Web Component

Properties

Use properties and attributes to control the web component as well as pass required data to it. Some properties won't have an attribute name, this is because to use that property you can't use it as an html attribute it must be set using javascript as a property of the element.

PropertyAttributeDescriptionTypeDefault
blockblockIf true, the button will have display=block and width=100%booleanfalse
colorcolorColor of button from DigiKey's color palette"alternate" | "outline" | "primary" | "reverseOutline" | "secondary""primary"
disableddisabledWhether button is disabled. When disabled, button is greyed and cannot be clicked.booleanfalse
formformIf type='submit' or 'reset', this links the button to an external form with the given idstring
hrefhrefIf set, the button will have the same appearance, but will actually be a link with the specified urlstring
sizesizeSize of the button"lg" | "md" | "sm""md"
targettargetIf href is set, target determines where to open the link. Options are '_blank', '_self', '_parent', '_top', or the name of an iframestring
typetypeIf set to 'submit' or 'reset', the button will have that role inside a form"button" | "reset" | "submit""button"

Primary

<dk-button>Button</dk-button>

Link

<dk-button href="/docs/components/button/web-component">
        Link Button
    </dk-button>

Sizes

<div>
        <h3>primary</h3>
        <dk-button color="primary" size="sm">
            Small
        </dk-button>
        <dk-button color="primary" size="md">
            Medium
        </dk-button>
        <dk-button color="primary" size="lg">
            Large
        </dk-button>
        <h3>secondary</h3>
        <dk-button color="secondary" size="sm">
            Small
        </dk-button>
        <dk-button color="secondary" size="md">
            Medium
        </dk-button>
        <dk-button color="secondary" size="lg">
            Large
        </dk-button>
        <h3>alternate</h3>
        <dk-button color="alternate" size="sm">
            Small
        </dk-button>
        <dk-button color="alternate" size="md">
            Medium
        </dk-button>
        <dk-button color="alternate" size="lg">
            Large
        </dk-button>
    </div>