Docs

Main site

Installation Browser support Extend config MCP server
Validation Page speed testing Responsive design
Accordion Aspect Ratio Avatar Badge Banner Bento Grid Blockquote Breadcrumbs Button Callout Card Drawer Dropdown Link Modal Navbar Navblock Pagination Popover Progress Separator Tabs Timeline Toast Tooltip
Checkbox Datepicker File upload Form field Input Label OTP Radio Range Select Textarea Toggle
Header Footer
Accordion Auth Checkbox & Radio Content Drawers Features Modals Statistics & Metrics Teams Dropdowns
Address Contact number Currency symbol Date Emirates ID Name
Close
Home Documentation Components Button

Button

Buttons let users make choices and take action. A Button is the primary call-to-action element of any UAE Design System. The button component renders a real native "button" internally and exposes a rich set of properties.

Action Interactive
Status
Active
Introduced
4.0.x
View source code

Anatomy

The aegov-button component composes a single native <button> element with full keyboard, focus, and screen-reader support. Its visual style is driven by three orthogonal properties: variant (the colour family — primary, secondary, danger, neutral), appearance (the visual treatment — solid, outline, soft, link), and size (xs through xl).

Additional state properties handle loading, disabled, full-width, icon-only, and group positioning.

Image showing anatomy of an button

Item Name Description
1 Icon Can be positioned either before (start) or after (end) the label
2 Label Text attributed to the button to provide context
3 Container The HTML container that is generated for the component

Options

The button has options for different use cases. These are considered the basic properties that are applicable to a button.

Primary Secondary

Variants

The variant property selects the colour family. Using the value as primary or secondary will allow you to set the button based on the theme.

These are indeed, the primary and secondary buttons to be used and can be branded.

Danger Neutral min Neutral max

Neutral Variants

The variant property also allows the creation of fixed neutral colours - neutral-min, neutral-max and danger. These must be used appropriately in neutral environments.

These buttons cannot be branded. Their colour remains fixed.

Solid Outline Soft Link

Appearances

The appearance property selects the visual treatment that wraps the variant colour. Each variant works with every appearance. The options are solid, outline, soft or link

<aegov-button 
	appearance="solid"
>Solid</aegov-button>

Size

The size property controls the height and font size of a button. Size also controls the size of icons placed within, border roundness and more.

Token Height Typical use case
xs 36px (h-9) Compact toolbars, table-row inline, least important action
sm 40px (h-10) Ideal table row button on data tables, dense forms etc
base 44px (h-11) Default, website actions, page level actions
lg 48px (h-12) Hero sections, meant for larger screens
xl 52px (h-13) Marketing landing pages, extra large screens

Size is a responsive property and can accept a token per breakpoint.

XS button SM button Base button LG button XL button
<aegov-button size="xs">XS button</aegov-button>
<aegov-button size="sm">SM button</aegov-button>
<aegov-button size="base">Base button</aegov-button>
<aegov-button size="lg">LG button</aegov-button>
<aegov-button size="xl">XL button</aegov-button>

Responsive size

size can also be set per breakpoint using a responsive string — for example size="sm md:base xl:lg". Any of the five tokens above are valid at any breakpoint. Pick a value to preview what it resolves to.

Take snapshot
<aegov-button size="sm md:base xl:lg">Take snapshot</aegov-button>

Icons

The default slot accepts any inline content, including SVG icons.

Settings Next Login

Leading & trailing

Place an icon before the label for a "leading" icon, after the label for a "trailing" icon. Size of icons are controlled based on the size property.

<aegov-button>
	<svg />
      Settings
</aegov-button>

Icon only

By adding a is-icon=true property, the button will be rendered as a icon button only and not allow a text label. This is very useful to create a toolbar of icons.

Always supply an aria-label so screen readers announce the button's purpose.

<aegov-button is-icon="true" aria-label="content">
	<svg />
</aegov-button>

State

A state is the interactive change on an element when a user action is triggered.

Image showing typical standard button state

Base

The default style before the user interacts with the button.

Image showing button hover state

Hover

The button changes style to let the user know it’s interactive.

Image showing button hover state

Focus

Communicates that a user has highlighted a button (e.g. via keyboard)

Access information

Disabled

Communicates that a button exists, but isn’t available in that scenario. When the user hovers over a button in a disabled state, the cursor shows as "not allowed".

A disabled button leaves the Tab order. Add is-disabled-focusable to keep it focusable (with aria-disabled="true") so keyboard and screen-reader users can still reach it and any explanation of why it is unavailable.

Disabled buttons maintain layout consistency and communicate that a button may become available if another condition is met.

Loading ...

Loading

Communicates that an action will become available when loading is complete, or that an action is being completed.

The background colour of the button changes and a loading indicator is displayed. The button keeps focus and stays in the Tab order while loading, but ignores activation.

Full width

Set is-full="true" to stretch the button to the full width of its container. This is the recommended layout for primary actions in mobile forms, modals, and authentication flows.

Log in with UAE Pass

Button group

The aegov-button-group component visually joins two or more aegov-button children edge-to-edge by collapsing internal borders and adjusting corner radii.

It supports horizontal (default) and vertical orientations, and works with every variant, appearance, and size.

The group automatically writes a groupPosition (first / middle / last / single) and groupOrientation (horizontal / vertical) onto each direct child button so the correct border and radius styles are applied.

Group of icons

Combine is-icon with a button group to create a compact toolbar. Always provide an aria-label on each icon-only button so screen readers can announce its purpose, and an aria-label on the group to describe the toolbar.

Day Week Month
<aegov-button-group>
  <aegov-button>Day</aegov-button>
  <aegov-button>Week</aegov-button>
  <aegov-button>Month</aegov-button>
</aegov-button-group>

// Icon only example
<aegov-button-group aria-label="Action toolbar">
  <aegov-button appearance="outline" is-icon="true" aria-label="Filter">
		<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><rect width="256" height="256" fill="none"/><line x1="128" y1="124" x2="128" y2="216" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="24"/><line x1="128" y1="40" x2="128" y2="84" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="24"/><line x1="200" y1="204" x2="200" y2="216" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="24"/><line x1="200" y1="40" x2="200" y2="164" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="24"/><line x1="224" y1="164" x2="176" y2="164" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="24"/><line x1="56" y1="172" x2="56" y2="216" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="24"/><line x1="56" y1="40" x2="56" y2="132" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="24"/><line x1="32" y1="132" x2="80" y2="132" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="24"/><line x1="152" y1="84" x2="104" y2="84" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="24"/></svg>
	</aegov-button>
  <aegov-button appearance="outline" is-icon="true" aria-label="Sort">
	<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><rect width="256" height="256" fill="none"/><line x1="48" y1="128" x2="116" y2="128" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="24"/><line x1="48" y1="64" x2="180" y2="64" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="24"/><line x1="48" y1="192" x2="100" y2="192" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="24"/><polyline points="144 168 184 208 224 168" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="24"/><line x1="184" y1="208" x2="184" y2="112" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="24"/></svg>
	</aegov-button>
  <aegov-button appearance="outline" is-icon="true" aria-label="Search">
	<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><rect width="256" height="256" fill="none"/><circle cx="112" cy="112" r="80" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="24"/><line x1="168.57" y1="168.57" x2="224" y2="224" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="24"/></svg></aegov-button>
</aegov-button-group>

RTL support

The button is direction-agnostic. When the document or any ancestor has dir="rtl", leading and trailing icons swap visually, gap and padding flip via CSS logical properties, and grouped border radii mirror correctly.

You must only control the content in the label based on a logical language file.

تحقق من حالة الطلب عرض الكل
<aegov-button>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><rect width="256" height="256" fill="none"/><path d="M200,224H56a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h96l56,56V216A8,8,0,0,1,200,224Z" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/><polyline points="152 32 152 88 208 88" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/><line x1="96" y1="136" x2="160" y2="136" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/><line x1="96" y1="168" x2="160" y2="168" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/></svg>
		تحقق من حالة الطلب
</aegov-button>
  
<aegov-button variant="secondary" appearance="outline">عرض الكل</aegov-button>

Usage

Here is the recommended usage of a button on any website or application. These are recommended usage guides, however the developer must use the best practices of web and application development to accurately use this component.

Allow sufficient hit area

When placing two or more buttons inline, make sure they are a sufficient size or have spacing between them to avoid users accidentally hitting the wrong button.

Do not use full width buttons in wide containers

Full-width buttons are more appropriate for small devices or contained components. Never use a full width button on a container that is more than 480px in width.

Do not separate related buttons

Place related buttons next to each other so associated actions are relative and to reduce cognitive load.

Do not stack buttons unnecessarily

Avoid stacking buttons when there’s enough space to place them side by side.

Do not have more than one primary button

Avoid having more than one primary (high emphasis) button on a screen to help guide the user to the primary action. Use the outline or soft appearance to pair with the primary button.

API reference

The following are the properties and references of a button

aegov-button default properties

AttributeDescriptionTypeDefault

field-id

DOM id for the inner <button> element. Auto-generated as aegov-button-{n} if omitted.

string

auto-generated

variant

The colour family

primary | secondary
danger | neutral-max | neutral-min

primary

appearance

The visual treatment

solid | outline | soft | link

solid

size

Size token. Accepts a single token or a Tailwind-style responsive string.

xs | sm | base | lg | xl

base

type

Native type attribute on the inner

button | submit | reset

button

name

Name submitted with the form, paired with value, when this button submits it — as on a native <button>.

string

undefined

value

Value submitted with name when this button submits the form.

string

undefined

is-disabled

Disables interaction. Sets the native disabled attribute on the inner button, so it leaves the Tab order — unless is-disabled-focusable is also set.

boolean

false

is-disabled-focusable

Keeps a disabled button in the Tab order. Used together with is-disabled, the inner button gets aria-disabled="true" instead of native disabled, so keyboard and screen-reader users still find it (and any text explaining why it is unavailable) while activation stays blocked. An ancestor <fieldset disabled> still disables the button natively.

boolean

false

is-loading

Shows a spinner, blocks activation and sets aria-busy="true" and aria-disabled="true". The button is not natively disabled, so it keeps focus and stays in the Tab order while loading.

boolean

false

is-icon

Renders the button as a square icon-only.

boolean

false

is-full

Stretches the button to the full width of its container.

boolean

false

is-bold

sets button label font weight

boolean

true

aegov-button-group default properties

AttributeDescriptionTypeDefault

orientation

Layout direction of the group.

horizontal | vertical

horizontal

Events

EventsDescriptionComponentDetail

aegovButtonClick

Fired when the button is clicked or keyboard-activated. Suppressed when the button is disabled (including by a <fieldset disabled> ancestor) or loading. Call event.detail.preventDefault() to cancel a submit/reset; preventDefault() on the custom event itself does not cancel it.

aegov-button

MouseEvent

aegovButtonFocus

Fired when the inner button receives focus.

aegov-button

FocusEvent

aegovButtonBlur

Fired when the inner button loses focus.

aegov-button

FocusEvent

<aegov-button field-id="confirm" variant="primary">Confirm</aegov-button>

<script>
  document.querySelector('#confirm').addEventListener('aegovButtonClick', (e) => {
    console.log('Confirmed at', new Date().toISOString());
  });
</script>

Pass-through attributes

AttributeNotesForwards to

aria-*

Any aria attribute that is not automatically added, e.g. aria-label, aria-expanded, aria-pressed. Changes after load are re-forwarded. ID-reference attributes (aria-labelledby, aria-describedby, aria-controls) do not resolve, because the inner button sits inside a shadow root — put descriptive text next to the button instead.

inner <button>

data-*

Any custom "data" attribute. Useful for analytics hooks.

inner <button>

aegov-button-group forwards aria-* and data-* attributes from the host to its wrapping <div>, which always carries role="group".

Notes

The following notes are applicable of this component.

Built-in accessibility

  • The aegov-button renders a <button> element. So it is focusable, keyboard-activatable, and exposed correctly to assistive technologies by default.
  • is-disabled sets the native disabled attribute, so the button leaves the Tab order. With is-disabled-focusable it gets aria-disabled="true" instead and stays focusable, while activation is still blocked.
  • Loading does not use native disabled: that would drop focus to the page mid-submit. A loading button keeps focus, is marked aria-disabled="true" and aria-busy="true", and ignores activation until loading ends.
  • The loading spinner SVG is aria-hidden="true". A visually hidden aria-live="polite" status region outside the button announces "Loading" (in Arabic on Arabic pages), so the word never becomes part of the button's name.
  • An icon-only button (is-icon) without aria-label, aria-labelledby or title logs a console warning. Once it is named, slotted <svg> icons are marked aria-hidden="true" automatically.
  • focus-visible outline is tuned per appearance.
  • aegov-button-group wraps its buttons in <div role="group"> and forwards all aria-* and data-* attributes from the host to that div.
  • aria-* and data-* attributes set on the host are forwarded to the inner <button>.

Developer responsibility

The following is required for a developer to add additionally or pay attention to regarding this component.

  • Provide an aria-label on every icon-only button. Slot content alone is not enough for accessibility.
  • Do not add aria-label to a button that has visible text. The visible text is already its name, and a different aria-label breaks voice control (a user saying "click Login" can't reach a button named "archive"). If you must add one, it has to start with the visible text.
  • For loading buttons whose visible label does not change, ensure to update the slot content. Example: A button label is "Save", but while the loading state, you must change it to "Saving ...". Ensure to also update aria-label content.
  • Do not wrap aegov-button inside another <button>. Nesting interactive elements is invalid HTML
  • The link appearance still renders a <button>. This must not be used for navigation. Refer to the component called aegov-link for that.
  • Inside a button group, every direct child must be an aegov-button (a wrapping <div> is also allowed, for layout). Any other element produces a console warning.

Additional notes

  • The loading state already blocks activation, so you do not also need to set is-disabled — and setting it would take the button out of the Tab order and drop focus.
  • The host element itself is not focusable. To move focus to the button from script, call its setFocus() method rather than focus().
  • type="submit" submits the surrounding form like a native submit button: the form is validated, and event.submitter in the submit handler is a hidden native <button> standing in for the aegov-button, carrying its name and value — so new FormData(form, event.submitter) and a native form post both include the pair. formaction, formenctype, formmethod, formnovalidate and formtarget set on aegov-button override the form's own settings for that submission.
  • type="reset" resets the surrounding form, even when one of its controls is named or has the id reset.
  • Icons placed inside the slot inherit the current text size automatically.
  • Nesting an aegov-button-group inside another aegov-button-group produces invalid structure and is not supported.
  • For consistent visuals inside a group, use the same size, variant and appearance on every child button. Mixed attributes are technically allowed but produce uneven results.