Alert
Announce important messages.
Usage
See using components for detailed instructions.
js
import { CAlert } from 'chusho';
Config
The options below are to be set in the global configuration at the following location:
js
{
components: {
alert: {
class: ({ variant }) => {},
},
},
}
class
Classes applied to the component root element, except when the prop bare
is set to true
. See styling components.
- type:
Array<String | Object> | Object | String | (props: Object) => {}
- default:
null
Example
js
class({ variant }) {
return ['alert', {
'alert--error': variant?.error,
'alert--warning': variant?.warning,
}]
}
API
Name | Type | Default | Description |
---|---|---|---|
Props | |||
variant | string|array|object | undefined | Useful when used in the component config |
bare | boolean | false | Disable class inheritance from the component config. See styling components. |
Examples
Simplest
template
<CAlert>An important message.</CAlert>
With variant
template
<CAlert variant="error">An important message.</CAlert>