Buttons
import { Button } from 'cx/widgets';Buttons are commonly used UI elements.
<Button onClick={() => { MsgBox.alert('Regular')}}>Regular</Button>
<Button pressed>Pressed</Button>
<Button disabled onClick={() => { MsgBox.alert('Disabled') }}>Disabled</Button>
<Button mod="primary" onClick={() => { MsgBox.alert('Primary') }}>Primary</Button>
<Button mod="danger"
confirm="You clicked the danger button. Are you sure that you want to proceed?"
onClick={() => {
MsgBox.alert('Danger')
}}>
Danger
</Button>
<Button mod="hollow" icon="pencil">Icon + Text</Button>
<Button mod="hollow" icon="refresh" />index.js
// Use Cx based message boxes to display confirmation dialog
import { enableMsgBoxAlerts } from 'cx/widgets';
enableMsgBoxAlerts();To enable Cx based message box alerts, call
enableMsgBoxAlerts()at startup of your application.
Configuration
| Property | Description | Type |
|---|---|---|
confirm | Confirmation text or configuration object. See MsgBox.yesNo for more details. | string/object |
disabled | Set to | boolean |
enabled | Set to | boolean |
pressed | If | boolean |
autoFocus | Set to | boolean |
baseClass | Base CSS class to be applied to the element. Default is 'button'. | string |
class | Additional CSS classes to be applied to the element. If an object is provided, all keys with a "truthy" value will be added to the CSS class list. | string/object |
dismiss | If set to | boolean |
focusOnMouseDown | Determines if button should receive focus on | boolean |
icon | Name of the icon to be put on the left side of the button. | string |
innerHtml | HTML to be injected into the element. | string |
items | List of child elements. | array |
layout | Define an inner layout. | string/object |
mod | Appearance modifier. Cx ships with | string/array |
outerLayout | Defines the outer layout which wraps the widget. | widget |
plainText | Set to | boolean |
preserveWhitespace | Keep whitespace in text based children. Default is | boolean |
putInto | Used with outer layouts. Specifies the name of the content placeholder which should render the widget. | string |
style | Style object applied to the wrapper div. Used for setting the dimensions of the element. | string/object |
submit | Add | boolean |
tag | HTML tag to be used. Default is | string |
text | Inner text contents. | string |
tooltip | Tooltip configuration. For more info see Tooltips. | string/object |
trimWhitespace | Remove all whitespace in text based children. Default is | boolean |
vdomKey | Key that will be used as the key when rendering the React component. | string |
visible | Visibility of the widget. Defaults to | boolean |