Skip to content
Theme:

Ui3nButton ​

Button component with various styles and capabilities.

Props

NameTypeDefaultDescription
idstring | undefined —

Root element id

type"primary" | "icon" | "secondary" | "tertiary" | "outline" | "custom" | undefined"primary"

Button type

size"regular" | "small" | "large" | undefined"regular"

Button size

squareboolean | undefined —

The unrounded button

blockboolean | undefined —

Whether to stretch the button to the full width of the parent block

textColorstring | undefined —

Button text color

colorstring | undefined —

Button background color

elevationboolean | undefined —

Add a raised effect to the button

iconstring | undefined —

The icon displayed on the button

iconSizestring | number | undefined —

Button icon size

iconColorstring | undefined —

Button icon color

iconPosition"right" | "left" | undefined"right"

Button icon position

disabledboolean | undefinedfalse

Put component in disabled mode

namestring | undefined — No description provided
placeholderstring | undefined — No description provided
valuestring | number | readonly string[] | undefined — No description provided
onCopy((payload: ClipboardEvent) => void) | undefined — No description provided
onCut((payload: ClipboardEvent) => void) | undefined — No description provided
onPaste((payload: ClipboardEvent) => void) | undefined — No description provided
onCompositionend((payload: CompositionEvent) => void) | undefined — No description provided
onCompositionstart((payload: CompositionEvent) => void) | undefined — No description provided
onCompositionupdate((payload: CompositionEvent) => void) | undefined — No description provided
onDrag((payload: DragEvent) => void) | undefined — No description provided
onDragend((payload: DragEvent) => void) | undefined — No description provided
onDragenter((payload: DragEvent) => void) | undefined — No description provided
onDragexit((payload: DragEvent) => void) | undefined — No description provided
onDragleave((payload: DragEvent) => void) | undefined — No description provided
onDragover((payload: DragEvent) => void) | undefined — No description provided
onDragstart((payload: DragEvent) => void) | undefined — No description provided
onDrop((payload: DragEvent) => void) | undefined — No description provided
onFocusin((payload: FocusEvent) => void) | undefined — No description provided
onFocusout((payload: FocusEvent) => void) | undefined — No description provided
onChange((payload: Event) => void) | undefined — No description provided
onBeforeinput((payload: InputEvent) => void) | undefined — No description provided
onFormdata((payload: FormDataEvent) => void) | undefined — No description provided
onInput((payload: InputEvent) => void) | undefined — No description provided
onReset((payload: Event) => void) | undefined — No description provided
onSubmit((payload: SubmitEvent) => void) | undefined — No description provided
onInvalid((payload: Event) => void) | undefined — No description provided
onFullscreenchange((payload: Event) => void) | undefined — No description provided
onFullscreenerror((payload: Event) => void) | undefined — No description provided
onLoad((payload: Event) => void) | undefined — No description provided
onError((payload: Event) => void) | undefined — No description provided
onKeydown((payload: KeyboardEvent) => void) | undefined — No description provided
onKeypress((payload: KeyboardEvent) => void) | undefined — No description provided
onKeyup((payload: KeyboardEvent) => void) | undefined — No description provided
onDblclick((payload: MouseEvent) => void) | undefined — No description provided
onMousedown((payload: MouseEvent) => void) | undefined — No description provided
onMouseenter((payload: MouseEvent) => void) | undefined — No description provided
onMouseleave((payload: MouseEvent) => void) | undefined — No description provided
onMousemove((payload: MouseEvent) => void) | undefined — No description provided
onMouseout((payload: MouseEvent) => void) | undefined — No description provided
onMouseover((payload: MouseEvent) => void) | undefined — No description provided
onMouseup((payload: MouseEvent) => void) | undefined — No description provided
onAbort((payload: UIEvent) => void) | undefined — No description provided
onCanplay((payload: Event) => void) | undefined — No description provided
onCanplaythrough((payload: Event) => void) | undefined — No description provided
onDurationchange((payload: Event) => void) | undefined — No description provided
onEmptied((payload: Event) => void) | undefined — No description provided
onEncrypted((payload: MediaEncryptedEvent) => void) | undefined — No description provided
onEnded((payload: Event) => void) | undefined — No description provided
onLoadeddata((payload: Event) => void) | undefined — No description provided
onLoadedmetadata((payload: Event) => void) | undefined — No description provided
onLoadstart((payload: Event) => void) | undefined — No description provided
onPause((payload: Event) => void) | undefined — No description provided
onPlay((payload: Event) => void) | undefined — No description provided
onPlaying((payload: Event) => void) | undefined — No description provided
onProgress((payload: ProgressEvent<EventTarget>) => void) | undefined — No description provided
onRatechange((payload: Event) => void) | undefined — No description provided
onSeeked((payload: Event) => void) | undefined — No description provided
onSeeking((payload: Event) => void) | undefined — No description provided
onStalled((payload: Event) => void) | undefined — No description provided
onSuspend((payload: Event) => void) | undefined — No description provided
onTimeupdate((payload: Event) => void) | undefined — No description provided
onVolumechange((payload: Event) => void) | undefined — No description provided
onWaiting((payload: Event) => void) | undefined — No description provided
onSelect((payload: Event) => void) | undefined — No description provided
onScroll((payload: Event) => void) | undefined — No description provided
onScrollend((payload: Event) => void) | undefined — No description provided
onTouchcancel((payload: TouchEvent) => void) | undefined — No description provided
onTouchend((payload: TouchEvent) => void) | undefined — No description provided
onTouchmove((payload: TouchEvent) => void) | undefined — No description provided
onTouchstart((payload: TouchEvent) => void) | undefined — No description provided
onAuxclick((payload: PointerEvent) => void) | undefined — No description provided
onContextmenu((payload: PointerEvent) => void) | undefined — No description provided
onGotpointercapture((payload: PointerEvent) => void) | undefined — No description provided
onLostpointercapture((payload: PointerEvent) => void) | undefined — No description provided
onPointerdown((payload: PointerEvent) => void) | undefined — No description provided
onPointermove((payload: PointerEvent) => void) | undefined — No description provided
onPointerup((payload: PointerEvent) => void) | undefined — No description provided
onPointercancel((payload: PointerEvent) => void) | undefined — No description provided
onPointerenter((payload: PointerEvent) => void) | undefined — No description provided
onPointerleave((payload: PointerEvent) => void) | undefined — No description provided
onPointerover((payload: PointerEvent) => void) | undefined — No description provided
onPointerout((payload: PointerEvent) => void) | undefined — No description provided
onBeforetoggle((payload: ToggleEvent) => void) | undefined — No description provided
onToggle((payload: ToggleEvent) => void) | undefined — No description provided
onWheel((payload: WheelEvent) => void) | undefined — No description provided
onAnimationcancel((payload: AnimationEvent) => void) | undefined — No description provided
onAnimationstart((payload: AnimationEvent) => void) | undefined — No description provided
onAnimationend((payload: AnimationEvent) => void) | undefined — No description provided
onAnimationiteration((payload: AnimationEvent) => void) | undefined — No description provided
onSecuritypolicyviolation((payload: SecurityPolicyViolationEvent) => void) | undefined — No description provided
onTransitioncancel((payload: TransitionEvent) => void) | undefined — No description provided
onTransitionend((payload: TransitionEvent) => void) | undefined — No description provided
onTransitionrun((payload: TransitionEvent) => void) | undefined — No description provided
onTransitionstart((payload: TransitionEvent) => void) | undefined — No description provided
autofocusBooleanish | undefined — No description provided
formstring | undefined — No description provided
formactionstring | undefined — No description provided
formenctypestring | undefined — No description provided
formmethodstring | undefined — No description provided
formnovalidateBooleanish | undefined — No description provided
formtargetstring | undefined — No description provided
data-ui3nstring | undefined — No description provided
innerHTMLstring | undefined — No description provided
accesskeystring | undefined — No description provided
contenteditableBooleanish | "inherit" | "plaintext-only" | undefined — No description provided
contextmenustring | undefined — No description provided
dirstring | undefined — No description provided
draggableBooleanish | undefined — No description provided
enterkeyhint"done" | "enter" | "go" | "next" | "previous" | "search" | "send" | undefined — No description provided
enterKeyHint"done" | "enter" | "go" | "next" | "previous" | "search" | "send" | undefined — No description provided
hidden"" | "hidden" | Booleanish | "until-found" | undefined — No description provided
inertBooleanish | undefined — No description provided
langstring | undefined — No description provided
spellcheckBooleanish | undefined — No description provided
tabindexNumberish | undefined — No description provided
titlestring | undefined — No description provided
translate"yes" | "no" | undefined — No description provided
radiogroupstring | undefined — No description provided
rolestring | undefined — No description provided
aboutstring | undefined — No description provided
datatypestring | undefined — No description provided
inlistany — No description provided
prefixstring | undefined — No description provided
propertystring | undefined — No description provided
resourcestring | undefined — No description provided
typeofstring | undefined — No description provided
vocabstring | undefined — No description provided
autocapitalizestring | undefined — No description provided
autocorrectstring | undefined — No description provided
autosavestring | undefined — No description provided
itempropstring | undefined — No description provided
itemscopeBooleanish | undefined — No description provided
itemtypestring | undefined — No description provided
itemidstring | undefined — No description provided
itemrefstring | undefined — No description provided
resultsNumberish | undefined — No description provided
securitystring | undefined — No description provided
unselectable"on" | "off" | undefined — No description provided
inputmode"search" | "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined —

Hints at the type of data that might be entered by the user while editing the element or its contents

isstring | undefined —

Specify that a standard HTML element should behave like a defined custom built-in element

exportpartsstring | undefined — No description provided
partstring | undefined — No description provided
aria-activedescendantstring | undefined —

Identifies the currently active element when DOM focus is on a composite widget, textbox, group, or application.

aria-atomicBooleanish | undefined —

Indicates whether assistive technologies will present all, or only parts of, the changed region based on the change notifications defined by the aria-relevant attribute.

aria-autocomplete"none" | "inline" | "list" | "both" | undefined —

Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be presented if they are made.

aria-busyBooleanish | undefined —

Indicates an element is being modified and that assistive technologies MAY want to wait until the modifications are complete before exposing them to the user.

aria-checkedBooleanish | "mixed" | undefined —

Indicates the current "checked" state of checkboxes, radio buttons, and other widgets.

aria-colcountNumberish | undefined —

Defines the total number of columns in a table, grid, or treegrid.

aria-colindexNumberish | undefined —

Defines an element's column index or position with respect to the total number of columns within a table, grid, or treegrid.

aria-colspanNumberish | undefined —

Defines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid.

aria-controlsstring | undefined —

Identifies the element (or elements) whose contents or presence are controlled by the current element.

aria-currentBooleanish | "page" | "step" | "location" | "date" | "time" | undefined —

Indicates the element that represents the current item within a container or set of related elements.

aria-describedbystring | undefined —

Identifies the element (or elements) that describes the object.

aria-detailsstring | undefined —

Identifies the element that provides a detailed, extended description for the object.

aria-disabledBooleanish | undefined —

Indicates that the element is perceivable but disabled, so it is not editable or otherwise operable.

aria-dropeffect"none" | "copy" | "execute" | "link" | "move" | "popup" | undefined —

Indicates what functions can be performed when a dragged object is released on the drop target.

aria-errormessagestring | undefined —

Identifies the element that provides an error message for the object.

aria-expandedBooleanish | undefined —

Indicates whether the element, or another grouping element it controls, is currently expanded or collapsed.

aria-flowtostring | undefined —

Identifies the next element (or elements) in an alternate reading order of content which, at the user's discretion, allows assistive technology to override the general default of reading in document source order.

aria-grabbedBooleanish | undefined —

Indicates an element's "grabbed" state in a drag-and-drop operation.

aria-haspopupBooleanish | "menu" | "listbox" | "tree" | "grid" | "dialog" | undefined —

Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element.

aria-hiddenBooleanish | undefined —

Indicates whether the element is exposed to an accessibility API.

aria-invalidBooleanish | "grammar" | "spelling" | undefined —

Indicates the entered value does not conform to the format expected by the application.

aria-keyshortcutsstring | undefined —

Indicates keyboard shortcuts that an author has implemented to activate or give focus to an element.

aria-labelstring | undefined —

Defines a string value that labels the current element.

aria-labelledbystring | undefined —

Identifies the element (or elements) that labels the current element.

aria-levelNumberish | undefined —

Defines the hierarchical level of an element within a structure.

aria-live"off" | "assertive" | "polite" | undefined —

Indicates that an element will be updated, and describes the types of updates the user agents, assistive technologies, and user can expect from the live region.

aria-modalBooleanish | undefined —

Indicates whether an element is modal when displayed.

aria-multilineBooleanish | undefined —

Indicates whether a text box accepts multiple lines of input or only a single line.

aria-multiselectableBooleanish | undefined —

Indicates that the user may select more than one item from the current selectable descendants.

aria-orientation"horizontal" | "vertical" | undefined —

Indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous.

aria-ownsstring | undefined —

Identifies an element (or elements) in order to define a visual, functional, or contextual parent/child relationship between DOM elements where the DOM hierarchy cannot be used to represent the relationship.

aria-placeholderstring | undefined —

Defines a short hint (a word or short phrase) intended to aid the user with data entry when the control has no value. A hint could be a sample value or a brief description of the expected format.

aria-posinsetNumberish | undefined —

Defines an element's number or position in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM.

aria-pressedBooleanish | "mixed" | undefined —

Indicates the current "pressed" state of toggle buttons.

aria-readonlyBooleanish | undefined —

Indicates that the element is not editable, but is otherwise operable.

aria-relevant"text" | "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals" | undefined —

Indicates what notifications the user agent will trigger when the accessibility tree within a live region is modified.

aria-requiredBooleanish | undefined —

Indicates that user input is required on the element before a form may be submitted.

aria-roledescriptionstring | undefined —

Defines a human-readable, author-localized description for the role of an element.

aria-rowcountNumberish | undefined —

Defines the total number of rows in a table, grid, or treegrid.

aria-rowindexNumberish | undefined —

Defines an element's row index or position with respect to the total number of rows within a table, grid, or treegrid.

aria-rowspanNumberish | undefined —

Defines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid.

aria-selectedBooleanish | undefined —

Indicates the current "selected" state of various widgets.

aria-setsizeNumberish | undefined —

Defines the number of items in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM.

aria-sort"none" | "ascending" | "descending" | "other" | undefined —

Indicates if items in a table or grid are sorted in ascending or descending order.

aria-valuemaxNumberish | undefined —

Defines the maximum allowed value for a range widget.

aria-valueminNumberish | undefined —

Defines the minimum allowed value for a range widget.

aria-valuenowNumberish | undefined —

Defines the current value for a range widget.

aria-valuetextstring | undefined —

Defines the human readable text alternative of aria-valuenow for a range widget.

Events

Event NameArguments / Value TypeDescription
clickvalue: Event —
entervalue: HTMLButtonElement —
initvalue: HTMLButtonElement —
focusvalue: Event —
blurvalue: Event —

Slots

Slot NameScope Props (v-slot)Description
#default —

Default slot

CSS Variables

Set any of these where you need it — on :root, on a container, or on the element itself through [data-ui3n] — and the component follows. Leave them alone and it uses the defaults below.

NameDefault
--ui3n-button-bg-colorvar(--color-bg-button-primary-default)
--ui3n-button-bg-color-disabledvar(--color-bg-button-primary-disabled)
--ui3n-button-bg-color-hovervar(--color-bg-button-primary-hover)
--ui3n-button-bg-color-pressedvar(--color-bg-button-primary-pressed)
--ui3n-button-border-radiuscalc(var(--_button-height) / 2)
--ui3n-button-font-size12px
--ui3n-button-font-size-largevar(--ui3n-button-font-size, 15px)
--ui3n-button-font-size-regularvar(--ui3n-button-font-size, 12px)
--ui3n-button-font-size-smallvar(--ui3n-button-font-size, 12px)
--ui3n-button-gap4px
--ui3n-button-height32px
--ui3n-button-height-largevar(--ui3n-button-height, 48px)
--ui3n-button-height-regularvar(--ui3n-button-height, 32px)
--ui3n-button-height-smallvar(--ui3n-button-height, 24px)
--ui3n-button-icon-size-large48px
--ui3n-button-icon-size-regular32px
--ui3n-button-icon-size-small24px
--ui3n-button-outline-colortransparent
--ui3n-button-outline-color-focusedvar(--_button-text-color)
--ui3n-button-outline-color-hovervar(--_button-text-color)
--ui3n-button-outline-color-pressedvar(--_button-text-color)
--ui3n-button-padding0 16px
--ui3n-button-padding-largevar(--ui3n-button-padding, 0 16px)
--ui3n-button-padding-regularvar(--ui3n-button-padding, 0 16px)
--ui3n-button-padding-smallvar(--ui3n-button-padding, 0 8px)
--ui3n-button-padding-when-icon8px
--ui3n-button-shadow-far-colorvar(--shadow-key-2)
--ui3n-button-shadow-inset-colorvar(--shadow-key-3)
--ui3n-button-shadow-near-colorvar(--shadow-key-1)
--ui3n-button-text-colorvar(--color-text-button-primary-default)
--ui3n-button-text-color-disabledvar(--color-text-button-primary-disabled)
--ui3n-button-text-color-focusedvar(--color-text-button-primary-default)
--ui3n-button-text-color-hovervar(--color-text-button-primary-hover)
--ui3n-button-text-color-pressedvar(--color-text-button-primary-pressed)

Usage Examples ​

Simple button ​

Simple button

Simple button usage

Button types ​

Button types

Different button types: primary, secondary, tertiary, outline, icon, custom

Button sizes ​

Button sizes

Regular, small and large button sizes

Buttons with icons ​

Buttons with icons

Buttons with icons on the left or right side

Button states ​

Button states

Disabled, block and elevated buttons

Square buttons ​

Square buttons

Buttons with square corners using the square prop

Icon customization ​

Icon customization

Custom icon size and color using iconSize and iconColor props

Events ​

Events

Button events: init, click, enter, focus, blur

Event log (last 5):
No events yet