function / @typed/ui/Role

Role

Renders a generic element with caller-selected ARIA semantics.

Learn this UI primitive →

Package version
1.0.0-beta.13
Category
Semantic hosts
Since
1.0.0

Import

import { Role } from "@typed/ui/Role";

Signatures

export declare function Role<const Options extends RoleOptions, const Host extends HostResult = never>(options: Options, host?: Dom.HostOverride<Dom.RenderHostProps<Options, RoleInternalProps<Options>>, Options["content"], Host>): Fx<RenderEvent, Renderable.Error<Options | Host>, Renderable.Services<Options | Host> | Scope.Scope | RenderTemplate>;

Why

It provides cooperative host composition without pretending every ARIA role has identical keyboard behavior; the caller remains responsible for the chosen role’s complete accessibility contract.

Ownership and lifetime

Running the returned Fx owns dynamic attributes and content until its Effect Scope closes. A custom host must preserve the supplied role.

Examples

import { Role } from "@typed/ui/Role"

const status = Role({ role: "status", content: "Ready" })

Other public imports

These import paths expose the same declaration. Each page retains its own public name and signature.

Source