useStatus

Commons
stable

Resolves semantic status props (success, info, warning, error) into icon slots, status classes, and a forced intent color. The status intent overrides any color / bgColor the consumer passed — a status colour is non-negotiable by design. Also manages icon routing across prepend / append / replace slots based on statusIconPosition.

API

Signature

Signature TypeScript complète extraite du fichier du composable.

typescript

Interfaces consommées

IStatusProps
IAdjacentProps

API

Paramètres

Paramètres d'entrée acceptés par ce composable.

props
requis
IStatusProps & IAdjacentProps
Component props. Reads status (TStatus: success | info | warning | error), statusIconPosition (prepend | append | both | replace), prependIcon, appendIcon, and icon. When status is set and statusIconPosition is replace, the status icon overwrites props.icon; when prepend/append/both, it fills the matching slot only if no explicit icon prop was passed.
name
string
getCurrentInstanceName()
Component name used to build the BEM modifier class `{name}--{status}` (e.g. origam-alert--success). Defaults to the current Vue instance name.

API

Valeurs de retour

Propriétés et méthodes exposées par l'objet retourné par le composable.

icon
Resolved center/replace icon. Returns the status icon when statusIconPosition="replace" and no explicit props.icon was provided, otherwise passes through props.icon.
prependIcon
Resolved prepend-slot icon. Injects the status icon when statusIconPosition is prepend or both and props.prependIcon is unset.
appendIcon
Resolved append-slot icon. Injects the status icon when statusIconPosition is append or both and props.appendIcon is unset.
statusClasses
Array containing `{name}--{status}` when a status is set, empty otherwise. Bind to the root element for SCSS state selectors.
statusIntent
The resolved TColor intent for the current status (success→success, info→info, warning→warning, error→danger). Undefined when no status is set. Consumed by useStateEffect to force the semantic surface color.

Usage

Exemples

Extraits de code prêts à coller.

Alert with prepend status icon

vue

Status icon in replace position

vue