Skip to content
On this page

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

NameTypeDefaultDescription
Props
variant string|array|objectundefined

Useful when used in the component config class option, to style it conditionally. See styling components.

bare booleanfalse

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>

Released under the MIT License.