<DropdownButton>
Component
<DropdownButton>
is a <ToggleButton>
component with a <Dropdown>
.
Here the demo:
<DropdownButton>
Component<DropdownButton>
is a <ToggleButton>
component with a <Dropdown>
.
Here the demo:
<DropdownButton>
ComponentThere are 2 ways to install <DropdownButton>
component into your react app project:
<DropdownButton>
Component<DropdownButton>
ComponentThe <DropdownButton>
should have one child to be dropdown-ed. The child shoud be a native DOM element or functional/class component that implements <Generic>
's props.
<DropdownButton>
<YourComponent />
</DropdownButton>
expanded
PropertyExpands/Collapses the <Dropdown>
of <DropdownButton>
.
The possible values are:
undefined
true
false
Here the preview:
<DropdownButton expanded={true}>Â
defaultExpanded
PropertyDefines the initial expanded
state when the <DropdownButton>
is first loaded.
The possible values are:
undefined
true
false
onExpandedChange
PropertySets a callback function to be called when the user closes the <DropdownButton>
.
The callback function parameters:
event: ExpandedChangeEvent
orientation
PropertySets the orientation and the direction of the <DropdownButton>
.
The possible values are:
undefined
'inline-start'
'inline-end'
'block-start'
'block-end'
Here the preview:
dropdownOrientation
PropertySets the orientation of the internal <Dropdown>
component used as the composition of <DropdownButton>
component.
<DropdownButton dropdownOrientation='inline' />
is equivalent to:<DropdownButton dropdownComponent={
<Dropdown orientation='inline' />
} />
Here the preview:
lazy
PropertyDetermines whenever the <DropdownButton>
's children
should be rendered or not when the <DropdownButton expanded={false}>
.
The possible values are:
undefined
false
true
onClick
PropertyExecutes a JavaScript's callback function when the <DropdownButton>
is clicked.
Determines how the <Dropdown>
of <DropdownButton>
should be floating on the <ToggleButton>
of <DropdownButton>
.
floatingOn
PropertyDetermines the target DOM reference where the <Dropdown>
of <DropdownButton>
should be floating on.
If not set (undefined
), the <Dropdown>
floating on the <ToggleButton>
of <DropdownButton>
.
Here the preview:
floatingPlacement
PropertyDetermines the location where the <Dropdown>
of <DropdownButton>
should be floating on the <ToggleButton>
of <DropdownButton>
.
Here the preview:
floatingPlacement='top'
floatingStrategy
PropertyDetermines the technical strategy how the <Dropdown>
of <DropdownButton>
can float.
In most cases, you should not worry about the detail mechanism how the <Dropdown>
of <DropdownButton>
can float.
The possible values are:
undefined
'absolute'
'fixed'
floatingAutoFlip
PropertyAutomatically flips the floatingPlacement
to opposite direction when the <Dropdown>
of <DropdownButton>
is about to be clipped.
The possible values are:
undefined
true
false
Here the preview:
floatingAutoShift
PropertyAutomatically shifts the floatingPlacement
to nearest safe position when the <Dropdown>
of <DropdownButton>
is about to be clipped.
The possible values are:
undefined
true
false
Here the preview:
floatingOffset
PropertyThe distance (in pixel) between the <Dropdown>
of <DropdownButton>
and the <ToggleButton>
of <DropdownButton>
.
The possible values are:
undefined
0
Here the preview:
<DropdownButton floatingOffset={0}>
floatingShift
PropertyThe distance (in pixel) between the <Dropdown>
of <DropdownButton>
and the default floatingPlacement
location.
The possible values are:
undefined
0
Here the preview:
<DropdownButton floatingShift={0}>
onFloatingUpdate
PropertySets a callback function to be called when the <Dropdown>
of <DropdownButton>
updates the position relative to the <ToggleButton>
of <DropdownButton>
.
The callback function parameters:
event: FloatingPosition
The alternative appearances of the <DropdownButton>
layout without changing the <DropdownButton>
's functionality.
size
PropertyDefines the alternative size of the <DropdownButton>
.
The possible values are:
undefined
'sm'
'md'
'lg'
Here the preview:
theme
PropertyDefines the contextual theme of the <DropdownButton>
.
The possible values are:
undefined
'primary'
'secondary'
'success'
'info'
'warning'
'danger'
'light'
'dark'
Here the preview:
gradient
PropertyActivates a 3D mode of the <DropdownButton>
.
The possible values are:
undefined
'inherit'
true
false
Here the preview:
outlined
PropertyActivates an outlined mode (background-less, contrast foreground, and contrast border) of the <DropdownButton>
.
The possible values are:
undefined
'inherit'
true
false
Here the preview:
mild
PropertyActivates a mild mode (mild background, contrast foreground, and contrast border) of the <DropdownButton>
.
The possible values are:
undefined
'inherit'
true
false
Here the preview:
The conditions of the <DropdownButton>
behavior or functionality.
enabled
PropertyDefines the enabled/disabled state of the <DropdownButton>
.
The possible values are:
undefined
true
false
Here the preview:
inheritEnabled
PropertyInfluences the <DropdownButton>
's disabled state by <ancestor enabled={false}>
.
The possible values are:
undefined
true
false
Here the preview:
Overwrites the internal (sub) components used as the composition of <DropdownButton>
component.
buttonComponent
PropertyOverwrites the internal <Button>
component used as the composition of <DropdownButton>
component.
<DropdownButton buttonComponent={
<MyCustomButton />
} />
buttonRef
PropertyGets the DOM reference of the internal <Button>
component used as the composition of <DropdownButton>
component.
<DropdownButton buttonRef={fooButtonRef} />
is equivalent to:<DropdownButton buttonComponent={
<Button elmRef={fooButtonRef} />
} />
buttonOrientation
PropertySets the orientation of the internal <Button>
component used as the composition of <DropdownButton>
component.
<DropdownButton buttonOrientation='inline' />
is equivalent to:<DropdownButton buttonComponent={
<Button orientation='inline' />
} />
buttonChildren
PropertyDefines the nested element of the internal <Button>
component used as the composition of <DropdownButton>
component.
<DropdownButton buttonChildren={
<span>Hello World</span>
} />
is equivalent to:<DropdownButton buttonComponent={
<Button>
<span>Hello World</span>
</Button>
} />
toggleButtonComponent
PropertyOverwrites the internal <ToggleButton>
component used as the composition of <DropdownButton>
component.
<DropdownButton toggleButtonComponent={
<MyCustomToggleButton />
} />
dropdownComponent
PropertyOverwrites the internal <Dropdown>
component used as the composition of <DropdownButton>
component.
<DropdownButton dropdownComponent={
<MyCustomDropdown />
} />
dropdownRef
PropertyGets the DOM reference of the internal <Dropdown>
component used as the composition of <DropdownButton>
component.
<DropdownButton dropdownRef={fooDropdownRef} />
is equivalent to:<DropdownButton dropdownComponent={
<Dropdown elmRef={fooDropdownRef} />
} />
Because <DropdownButton>
is made from <ToggleButton>
, so all properties from <ToggleButton>
are inherited.