2.0.17 • Published 5 years ago
the-toast v2.0.17
the-toast
Toast of the-components
Installation
$ npm install the-toast --save
Usage
Live Demo is hosted on GitHub Page
'use strict'
import React from 'react'
import { TheToast, TheToastGroup, TheToastStyle } from 'the-toast'
class ExampleComponent extends React.PureComponent {
constructor(props) {
super(props)
this.state = {
messages: {
normal: ['This is normal', 'This is normal 2'],
info: ['This is info', 'This is info 2'],
warn: ['This is warn', 'This is warn 2'],
error: ['This is error', 'This is error 2']
}
}
}
render() {
const { messages } = this.state
const onUpdate = (values) => this.setState({
messages: Object.assign({}, this.state.messages, values)
})
return (
<React.StrictMode>
<div>
<TheToastStyle />
<TheToastGroup>
<TheToast.Normal onUpdate={onUpdate} messages={messages.normal} />
<TheToast.Info onUpdate={onUpdate} messages={messages.info} clearAfter={1200} />
<TheToast.Warn onUpdate={onUpdate} messages={messages.warn} />
<TheToast.Error onUpdate={onUpdate} messages={messages.error} />
</TheToastGroup>
</div>
</React.StrictMode>
)
}
}
export default ExampleComponent
Components
TheToast
Toast of the-components
Props
Name | Type | Description | Default |
---|---|---|---|
clearAfter | number | Clear message after seconds | -1 |
level | enum | Level of toast | 'normal' |
messages | arrayOf node | Messages to show |
|
onUpdate | func | Handle update |
|
role | 'alert' | ||
transitionTimeout | 100 |
TheToastGroup
ToastGroup
TheToastStyle
Style for TheToast
Props
Name | Type | Description | Default |
---|---|---|---|
options | object | Style options | {} |
License
This software is released under the MIT License.
Links
2.0.17
5 years ago
2.0.16
5 years ago
2.0.15
6 years ago
2.0.14
6 years ago
2.0.13
6 years ago
2.0.12
6 years ago
2.0.11
6 years ago
2.0.10
6 years ago
2.0.9
6 years ago
2.0.8
6 years ago
2.0.7
6 years ago
2.0.6
6 years ago
2.0.5
6 years ago
2.0.4
7 years ago
2.0.3
7 years ago
2.0.2
7 years ago
2.0.1
7 years ago
2.0.0
7 years ago
1.1.0
7 years ago
1.0.3
7 years ago
1.0.2
7 years ago
1.0.1
7 years ago
1.0.0
7 years ago