@loadsmart/miranda-wc
Version:
Miranda Web Components component library
22 lines (21 loc) • 637 B
TypeScript
type ObjectConditionDefinition = {
[key: string]: boolean | undefined;
};
export type ConditionDefinition = string | ObjectConditionDefinition;
/**
* Concatenate style properties or class names conditionally.
* Conditions can be functions that consume components props,
* objects, strings, or numbers (that will be coerced to strings).
* @example
* ```jsx
* // returns 'some-class class-a'
* conditional('some-class', {
* 'class-a': true,
* 'class-b': false,
* })
* ```
* @param conditions
* @returns {string}
*/
declare function conditional(...conditions: ConditionDefinition[]): string;
export default conditional;