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
Full TypeScript signature sourced from the composable file.
Consumed interfaces
IStatusProps
IAdjacentProps
API
Parameters
Input parameters accepted by this composable.
- propsrequiredIStatusProps & 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.
- namestringgetCurrentInstanceName()
- Component name used to build the BEM modifier class `{name}--{status}` (e.g. origam-alert--success). Defaults to the current Vue instance name.
API
Return values
Properties and methods exposed by the composable return object.
- 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
Examples
Ready-to-paste usage snippets.
Alert with prepend status icon
Status icon in replace position