Tenforce toolbox selector component
Once you are focused in on a toolbox-selector (either through clicking on one of the buttons or through a tabulation from another HTML element), you can use the arrows on your keyboard (left and right) to navigate between the different items.
Locked items (which only occur on required selectors when there is only one item selected) will automatically be skipped in this navigation.
Once focused on the item you want to toggle, simply press "space" and it will automatically be toggled on/off.
Top component, it contains a list of values and can have several options. Its children are of the type Item | ItemBlock | ItemBlockPart.
extraClasses
: String, classes to be added to this componentisDeactivated
: Boolean, whether the selector should be deactivatedisDisabled
: Boolean, whether the selector should be disabledisExpanded
: Boolean, whether all values are shown or notisLoading
: Boolean, whether the selector should show a loading animationisReadOnly
: Boolean, whether the selector should be read-onlyisRequired
: Boolean, whether at least one value should be kept selectedisSingleSelect
: Boolean, whether more than one item can be selectedisWrapped
: Boolean, whether the selector items are flex wrapped or not
This component represents a value that can be toggled on and off. Its children are of the type Block.
isPlaceholder
: Boolean, whether it should be dimmed or notisSelected
: Boolean, whether this item is selectedonSelected
: Function, to be called when an item is selected. In most cases it will end up modifying the variable used forisSelected
onUnselected
: Function, to be called when an item is unselected. In most cases it will end up modifying the variable used forisSelected
extraClasses
: String, classes to be added to this component
This component is a list of parts that represent a single entity. Its children are of the type Part.
isPlaceholder
: Boolean, whether it should be dimmed or notextraClasses
: String, classes to be added to this component
A subdivision of a Block.
color
: String, a color code for this PartisPlaceholder
: Boolean, whether it should be dimmed or notisLabel
: Boolean, whether it should be label designed or notextraClasses
: String, classes to be added to this component
For ease of use, we've added a few predefined components.
Checkboxes are a selector with two items. It can be used to render three possible states (checked, unchecked, undefined).
Same props as Selector but also with:
isChecked
: Boolean, whether the truthy value is selectedisUnchecked
: Boolean, whether the falsy value is selected. This is set to be the opposite ofisChecked
if left undefined. Setting it allows the appearance of a three state checkbox.onChecked
: Function, to be called when the truthy value is selectedonRemoveCheck
: Function, to be called when the truthy value is unselectedonUnchecked
: Function, to be called when the falsy value is selectedonRemoveUncheck
: Function, to be called when the falsy value is unselectedcheckLabel
: String, the label for the truthy valuecheckColor
: String, the color for the truthy valueuncheckLabel
: String, the label for the falsy valueuncheckColor
: String, the color for the falsy value
An ItemBlock is a combination of an Item and a Block component. You can use it to shorten the code when an item as a single block.
Same props as an Item but also with:
blockProps
: Object, the props for the Block component
An ItemBlockPart is a combination of an Item, a Block and a Part component. You can use it to shorten the code when an item as a single block and a single part.
Same props as an Item but also with:
blockProps
: Object, the props for the Block componentpartProps
: Object, the props for the Part component
An BlockPart is a combination of a Block and a Part component. You can use it to shorten the code when a block as a single part.
Same props as an Block but also with:
partProps
: Object, the props for the Part component
Selector
<Selector
singleSelect={singleSelect}
required={required}
expanded={expanded}
extraClasses={extraClasses}>
<Item isSelected={androidSelected}
onSelected={() => this.setState({androidSelected: true})}
onUnselected={() => this.setState({androidSelected: false})}>
<Block>
<Part color="#e50015"></Part>
<Part>android</Part>
</Block>
<BlockPart>
iOs
</BlockPart>
</Item>
<ItemBlock
isSelected={iosSelected}
onSelected={() => this.setState({iosSelected: true})}
onUnselected={() => this.setState({iosSelected: false})}>
<Part color="#00baef"/>
<Part isLabel={true}>ios</Part>
</ItemBlock>
<ItemBlockPart
isSelected={webSelected}
onSelected={()=>this.setState({webSelected: true})}
onUnselected={()=>this.setState({webSelected: false})}
partProps={{color: "#00ff00"}}>
web
</ItemBlockPart>
</Selector>
Checkbox
<Checkbox
isChecked={checked}
checkLabel={checkLabel}
checkColor={checkColor}
uncheckLabel={uncheckLabel}
uncheckColor={uncheckColor}
onChecked={()=>this.setState({checked:true})}
onUnchecked={()=>this.setState({checked:false})}
extraClasses={extraClasses}/>