useMessage
Commons
stable
Resolves the active message to display below a form field. Prioritises errorMessages and validation results over hint text, falling back to the explicit messages prop or the #message slot. Returns a boolean flag to conditionally render the message zone.
API
Signature
Signature TypeScript complète extraite du fichier du composable.
API
Paramètres
Paramètres d'entrée acceptés par ce composable.
- propsrequisIMessageProps
- Field props containing the message sources: `messages` (info), `errorMessages` (validation errors), and `hint` (helper text).
- otherMessagesRef<Array<string>> | ComputedRef<Array<string>>ref([])
- External messages array injected by a parent form or validation layer (e.g. from useValidation). Takes precedence over hint when non-empty.
API
Valeurs de retour
Propriétés et méthodes exposées par l'objet retourné par le composable.
- hasMessages
- True when at least one message source is active: messages prop, errorMessages, otherMessages, or the #message slot. Use to show/hide the message zone.
- messages
- The resolved message(s) to display. Priority: errorMessages / otherMessages > hint > messages. Returns an empty array when nothing is active.
Usage
Exemples
Extraits de code prêts à coller.
Field with hint and error message
Used inside OrigamTextField