useProps
Commons
stable
Returns a filterProps utility that picks only the keys declared on a component interface from an arbitrary props object, stripping undefined values so that Vue 3 boolean-prop coercion does not silently override withDefaults in child components. Used by composite components (DataTable, List, Select…) to forward a safe subset of their own props to child Origam components.
API
Signature
Signature TypeScript complète extraite du fichier du composable.
Interfaces consommées
IFilterPropsOptions
API
Paramètres
Paramètres d'entrée acceptés par ce composable.
- propsrequisT
- The component interface (or a plain object with the same keys) that defines the allowed prop surface. Only keys present here will be picked by filterProps.
API
Valeurs de retour
Propriétés et méthodes exposées par l'objet retourné par le composable.
- props
- The same props object passed in, re-exposed for convenience.
- filterProps
- Picks the intersection of properties keys with the declared prop surface, then removes undefined values. The excludes list defaults to ["class", "style", "id"] — class and style forwarding is handled separately via $attrs.
Usage
Exemples
Extraits de code prêts à coller.
Forward a safe prop subset to a child
Custom excludes