Buttons
<oge-button> is a token-themed action button with semantic severities, three fill styles, badges and gesture superpowers (async actions, click guarding, hold-to-confirm, auto-repeat — see the Interactions page). Bind (clicked) for the guarded pipeline; every state is driven by design tokens, so dark mode and the bridge themes work out of the box.
Severities & styling modes
Five semantic severities (normal, accent, success, warning, danger) map straight to the design tokens, so every theme restyles them automatically. Each severity combines with three fill styles — contained (solid, the default), outlined and text — giving you the full action hierarchy of a page from one component.
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { OgeButton } from '@oge-ui/buttons';
@Component({
selector: 'demo-root',
imports: [OgeButton],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<oge-button text="Contained" severity="accent" />
<oge-button text="Outlined" severity="accent" stylingMode="outlined" />
<oge-button text="Text" severity="accent" stylingMode="text" />
<oge-button text="Success" severity="success" />
<oge-button text="Warning" severity="warning" />
<oge-button text="Danger" severity="danger" />
`,
})
export class Demo {}Sizes
Four presets — xs (24px), sm (28px), md (34px, default) and lg (42px), each read from a --oge-control-height-* token you can override with rem values. The scale is shared with the input editors, so a button placed next to a text box of the same size lines up pixel-perfect in form rows.
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { OgeButton } from '@oge-ui/buttons';
@Component({
selector: 'demo-root',
imports: [OgeButton],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<oge-button text="Extra small" size="xs" />
<oge-button text="Small" size="sm" />
<oge-button text="Medium" />
<oge-button text="Large" size="lg" />
`,
})
export class Demo {}Icons
There is no icon-font dependency: project any inline SVG with the ogeButtonIcon attribute and it inherits the button's color. iconPosition places it before or after the label. Icon-only buttons must provide an accessible name via ariaLabel (or a hint tooltip).
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { OgeButton, OgeButtonIcon } from '@oge-ui/buttons';
@Component({
selector: 'demo-root',
imports: [OgeButton, OgeButtonIcon],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<oge-button text="Download" severity="accent">
<svg ogeButtonIcon viewBox="0 0 24 24" width="14" height="14" fill="none"
stroke="currentColor" stroke-width="2" aria-hidden="true">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" />
<polyline points="7 10 12 15 17 10" /><line x1="12" y1="15" x2="12" y2="3" />
</svg>
</oge-button>
<!-- icon after the label -->
<oge-button text="Next" iconPosition="after">
<svg ogeButtonIcon viewBox="0 0 24 24" width="14" height="14" fill="none"
stroke="currentColor" stroke-width="2" aria-hidden="true">
<polyline points="9 18 15 12 9 6" />
</svg>
</oge-button>
<!-- icon-only: give it an accessible name via hint -->
<oge-button hint="Settings">
<svg ogeButtonIcon viewBox="0 0 24 24" width="14" height="14" fill="none"
stroke="currentColor" stroke-width="2" aria-hidden="true">
<circle cx="12" cy="12" r="3" />
</svg>
</oge-button>
`,
})
export class Demo {}Custom colors
The color input accepts any CSS color and overrides the severity palette for that one button — the hover shade and focus ring derive automatically. For brand-wide changes, override the --oge-* tokens instead: globally, per theme file, or inline on a single element.
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { OgeButton } from '@oge-ui/buttons';
@Component({
selector: 'demo-root',
imports: [OgeButton],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<!-- any CSS color; the soft tint derives automatically -->
<oge-button text="Purple" color="#7c3aed" />
<oge-button text="Teal" color="#0d9488" stylingMode="outlined" />
<!-- or override the design tokens per instance / theme-wide -->
<oge-button
text="Brand token"
severity="accent"
style="--oge-accent: #ea580c; --oge-accent-soft: rgba(234, 88, 12, 0.14)"
/>
`,
})
export class Demo {}Badges
A number or string renders a pill in the button's corner; numbers cap at 99+. The value joins the button's accessible name through a visually hidden span, so screen readers announce it. Passing true renders a plain attention dot instead.
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { OgeButton } from '@oge-ui/buttons';
@Component({
selector: 'demo-root',
imports: [OgeButton],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<oge-button text="Inbox" [badge]="7" />
<oge-button text="Alerts" [badge]="120" severity="accent" stylingMode="outlined" />
<oge-button text="Live" [badge]="true" stylingMode="text" />
`,
})
export class Demo {}Toggle button
toggle turns a standalone button into a WAI-ARIA toggle button: every accepted click flips the two-way selected state and the native button announces aria-pressed. Pressed reads at a glance in every styling mode — accent tint, solid edge and an underline indicator (a system-colour fill under forced colours) — while an unpressed toggle keeps a readable label, never the disabled look. Inside a single/multiple button group the group keeps owning the selection; a plain toolbar group (selectionMode="none") lets each button toggle itself.
Bold true · Italic false · Pinned true
import { ChangeDetectionStrategy, Component, signal } from '@angular/core';
import { OgeButton } from '@oge-ui/buttons';
import type { OgeButtonSelectedChangedEvent } from '@oge-ui/buttons';
@Component({
selector: 'demo-root',
imports: [OgeButton],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<!-- toggle + [(selected)] = a WAI-ARIA toggle button: the native button
renders aria-pressed="true|false" and every accepted click flips it. -->
<oge-button text="Bold" [toggle]="true" [(selected)]="bold" />
<oge-button
text="Italic"
stylingMode="outlined"
[toggle]="true"
[(selected)]="italic"
(selectedChanged)="log($event)"
/>
<oge-button text="Pinned" stylingMode="text" [toggle]="true" [selected]="true" />
<oge-button text="Locked" [toggle]="true" [selected]="true" [disabled]="true" />
`,
})
export class Demo {
protected readonly bold = signal(true);
protected readonly italic = signal(false);
protected log(event: OgeButtonSelectedChangedEvent): void {
console.log(event.previousValue, '→', event.selected);
}
}Link, pill, fluid and pressed
stylingMode="link" looks like inline link text and stays a button; shape="pill" rounds the ends; fluid fills the row. loadingText replaces the label while loading, and iconClass draws an icon-font glyph without projected markup. pressed is a pressed state the page owns: the view switch below sets it from its own state — a click reports, it never flips by itself.
import { ChangeDetectionStrategy, Component, signal } from '@angular/core';
import { OgeButton } from '@oge-ui/buttons';
@Component({
selector: 'demo-root',
imports: [OgeButton],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<oge-button text="Read the guide" stylingMode="link" />
<oge-button text="Pill" shape="pill" severity="accent" />
<!-- an icon font the app ships, no projected markup -->
<oge-button text="Print" iconClass="fa-solid fa-print" />
<oge-button text="Save" loadingText="Saving…" [loading]="saving()" (clicked)="save()" />
<!-- pressed: the page owns the state; a click reports, it never flips by itself -->
<oge-button text="Grid" [pressed]="view() === 'grid'" (clicked)="view.set('grid')" />
<oge-button text="List" [pressed]="view() === 'list'" (clicked)="view.set('list')" />
<oge-button text="Continue" severity="accent" [fluid]="true" />
`,
})
export class Demo {
protected readonly view = signal<'grid' | 'list'>('grid');
protected readonly saving = signal(false);
protected save(): void {
this.saving.set(true);
setTimeout(() => this.saving.set(false), 1200);
}
}Notes
- Bind
(clicked), not native(click)— only the component output goes throughclickGuard, the gestures and the single-flightactionprotection. useSubmitBehaviorrenderstype="submit"so the button submits its enclosing form; the default is alwaystype="button".- Numeric badges join the accessible name via a visually hidden span; the dot variant is decorative (
aria-hidden). - RTL needs no configuration — layout uses logical properties and follows the surrounding
dirattribute.