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.

| 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.
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.
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.
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.
<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>
import { AegovButton } from '@aegov/designsystem-react';
export default function ButtonSizes() {
return (
<>
<AegovButton size="xs">XS button</AegovButton>
<AegovButton size="sm">SM button</AegovButton>
<AegovButton size="base">Base button</AegovButton>
<AegovButton size="lg">LG button</AegovButton>
<AegovButton size="xl">XL button</AegovButton>
</>
);
}
<template>
<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>
</template>
import { Component } from '@angular/core';
import { AegovButton } from '@aegov/designsystem-angular';
@Component({
selector: 'app-button-sizes',
imports: [AegovButton],
template: `
<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>
`,
})
export class ButtonSizesComponent {}
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.
<aegov-button size="sm md:base xl:lg">Take snapshot</aegov-button>
import { AegovButton } from '@aegov/designsystem-react';
export default function ResponsiveButton() {
return <AegovButton size="sm md:base xl:lg">Take snapshot</AegovButton>;
}
<template>
<aegov-button size="sm md:base xl:lg">Take snapshot</aegov-button>
</template>
import { Component } from '@angular/core';
import { AegovButton } from '@aegov/designsystem-angular';
@Component({
selector: 'app-responsive-button',
imports: [AegovButton],
template: `<aegov-button size="sm md:base xl:lg">Take snapshot</aegov-button>`,
})
export class ResponsiveButtonComponent {}
Icons
The default slot accepts any inline content, including SVG icons.
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.

Base
The default style before the user interacts with the button.

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

Focus
Communicates that a user has highlighted a button (e.g. via keyboard)
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
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.
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.
<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>
import { AegovButton, AegovButtonGroup } from '@aegov/designsystem-react';
export default function ButtonGroupExample() {
return (
<>
<AegovButtonGroup>
<AegovButton>Day</AegovButton>
<AegovButton>Week</AegovButton>
<AegovButton>Month</AegovButton>
</AegovButtonGroup>
{/* Icon only example */}
<AegovButtonGroup aria-label="Action toolbar">
<AegovButton appearance="outline" isIcon 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" strokeLinecap="round" strokeLinejoin="round" strokeWidth="24"/><line x1="128" y1="40" x2="128" y2="84" fill="none" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="24"/><line x1="200" y1="204" x2="200" y2="216" fill="none" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="24"/><line x1="200" y1="40" x2="200" y2="164" fill="none" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="24"/><line x1="224" y1="164" x2="176" y2="164" fill="none" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="24"/><line x1="56" y1="172" x2="56" y2="216" fill="none" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="24"/><line x1="56" y1="40" x2="56" y2="132" fill="none" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="24"/><line x1="32" y1="132" x2="80" y2="132" fill="none" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="24"/><line x1="152" y1="84" x2="104" y2="84" fill="none" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="24"/></svg>
</AegovButton>
<AegovButton appearance="outline" isIcon 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" strokeLinecap="round" strokeLinejoin="round" strokeWidth="24"/><line x1="48" y1="64" x2="180" y2="64" fill="none" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="24"/><line x1="48" y1="192" x2="100" y2="192" fill="none" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="24"/><polyline points="144 168 184 208 224 168" fill="none" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="24"/><line x1="184" y1="208" x2="184" y2="112" fill="none" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="24"/></svg>
</AegovButton>
<AegovButton appearance="outline" isIcon 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" strokeLinecap="round" strokeLinejoin="round" strokeWidth="24"/><line x1="168.57" y1="168.57" x2="224" y2="224" fill="none" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="24"/></svg>
</AegovButton>
</AegovButtonGroup>
</>
);
}
<template>
<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>
</template>
import { Component } from '@angular/core';
import { AegovButton, AegovButtonGroup } from '@aegov/designsystem-angular';
@Component({
selector: 'app-button-group-example',
imports: [AegovButton, AegovButtonGroup],
template: `
<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" [isIcon]="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" [isIcon]="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" [isIcon]="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>
`,
})
export class ButtonGroupExampleComponent {}
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>
import { AegovButton } from '@aegov/designsystem-react';
export default function RtlButtons() {
return (
<div dir="rtl">
<AegovButton>
<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" strokeLinecap="round" strokeLinejoin="round" strokeWidth="16"/><polyline points="152 32 152 88 208 88" fill="none" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="16"/><line x1="96" y1="136" x2="160" y2="136" fill="none" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="16"/><line x1="96" y1="168" x2="160" y2="168" fill="none" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="16"/></svg>
تحقق من حالة الطلب
</AegovButton>
<AegovButton variant="secondary" appearance="outline">عرض الكل</AegovButton>
</div>
);
}
<template>
<div dir="rtl">
<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>
</div>
</template>
import { Component } from '@angular/core';
import { AegovButton } from '@aegov/designsystem-angular';
@Component({
selector: 'app-rtl-buttons',
imports: [AegovButton],
template: `
<div dir="rtl">
<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>
</div>
`,
})
export class RtlButtonsComponent {}
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
| Attribute | Description | Type | Default |
|---|---|---|---|
| DOM id for the inner <button> element. Auto-generated as |
| auto-generated |
| The colour family |
|
|
| The visual treatment |
|
|
| Size token. Accepts a single token or a Tailwind-style responsive string. |
|
|
| Native type attribute on the inner |
|
|
| Name submitted with the form, paired with |
|
|
| Value submitted with |
|
|
| Disables interaction. Sets the native disabled attribute on the inner button, so it leaves the Tab order — unless |
|
|
| Keeps a disabled button in the Tab order. Used together with |
|
|
| Shows a spinner, blocks activation and sets |
|
|
| Renders the button as a square icon-only. |
|
|
| Stretches the button to the full width of its container. |
|
|
| sets button label font weight |
|
|
aegov-button-group default properties
| Attribute | Description | Type | Default |
|---|---|---|---|
| Layout direction of the group. |
|
|
Events
| Events | Description | Component | Detail |
|---|---|---|---|
| Fired when the button is clicked or keyboard-activated. Suppressed when the button is disabled (including by a | aegov-button |
|
| Fired when the inner button receives focus. | aegov-button |
|
| Fired when the inner button loses focus. | aegov-button |
|
<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
| Attribute | Notes | Forwards to |
|---|---|---|
| Any aria attribute that is not automatically added, e.g. | inner |
| Any custom "data" attribute. Useful for analytics hooks. | inner |
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-buttonrenders a<button>element. So it is focusable, keyboard-activatable, and exposed correctly to assistive technologies by default. is-disabledsets the nativedisabledattribute, so the button leaves the Tab order. Withis-disabled-focusableit getsaria-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 markedaria-disabled="true"andaria-busy="true", and ignores activation until loading ends. - The loading spinner SVG is
aria-hidden="true". A visually hiddenaria-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) withoutaria-label,aria-labelledbyortitlelogs a console warning. Once it is named, slotted<svg>icons are markedaria-hidden="true"automatically. focus-visibleoutline is tuned per appearance.aegov-button-groupwraps its buttons in<div role="group">and forwards allaria-*anddata-*attributes from the host to that div.aria-*anddata-*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-labelon every icon-only button. Slot content alone is not enough for accessibility. - Do not add
aria-labelto a button that has visible text. The visible text is already its name, and a differentaria-labelbreaks 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-labelcontent. - Do not wrap
aegov-buttoninside 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 calledaegov-linkfor 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 thanfocus(). type="submit"submits the surrounding form like a native submit button: the form is validated, andevent.submitterin thesubmithandler is a hidden native<button>standing in for theaegov-button, carrying itsnameandvalue— sonew FormData(form, event.submitter)and a native form post both include the pair.formaction,formenctype,formmethod,formnovalidateandformtargetset onaegov-buttonoverride 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 idreset.- Icons placed inside the slot inherit the current text size automatically.
- Nesting an
aegov-button-groupinside anotheraegov-button-groupproduces invalid structure and is not supported. - For consistent visuals inside a group, use the same
size,variantandappearanceon every child button. Mixed attributes are technically allowed but produce uneven results.