Multi Level Select

Default


The MultiLevelSelect kit renders a multi leveled select dropdown based on data from the user. treeData is a required prop that is expected to contain the data in the form of an array of objects. See code snippet for an example data array.

For the React version of the kit, the onSelect prop returns an array of objects. This array contains all checked items irrespective of whether it is a parent, child or grandchild. Open the console on this example and check and uncheck checkboxes to see this is action!

For the Rails version of the kit, there is no onselect. The form submits as a array of strings, following the typical rails pattern of utilizing hidden inputs. The strings are the values of the selected items' ids. For example, ["103", "106", "107"].

Single Select


Optionally enable the single variant to replace checkboxes with radios so the input accepts and returns only a single selection.

Single Select w/ Hidden Radios


Dynamically control your selectable options by passing hideRadio: true to any node within your tree data to omit that node's radio selector. In this example we've hidden all radios except ultimate children (nodes without descendants).

Return All Selected


The returnAllSelected or return_all_selected prop can be used when users want data on all checked nodes from the dropdown, irrespective of whether it is a parent or child node.

NOTE: This variant also does not automatically uncheck the parent when any of the child nodes are unchecked. returnAllSelected is set to false by default.

NOTE: For larger trees that may return many pill selections, you can optionally set input_display: "none"(for Rails) or inputDisplay = "none"(for React) to hide all pills within the input.

Selected Ids


selected_ids is an optional prop that accepts an array of ids that, if present, will mark the corresponding nodes on the treeData as checked on page load.

Items that include checked:true on the treeData itself will also be selected on page load, even without being passed to selectedIds.

When an item is marked as checked on page load by any means, the dropdown will expand to show the checked items for easier accessibility.

With Form


With Pills (Custom Color)


Change the form pill color by passing the optional pill_color prop. Product, Data, and Status colors are available options. Check them out here in the Form Pill colors example.

Reset Selection


In order to clear the multilevelselect selection using an external trigger (like a reset button), the clearMultiLevelSelect function can be used. See the code snippet below to see this in action. The function is scoped by id so an id MUST be used on the multilevelselect kit and passed to the function as shown for it to work.



Available Props

Props Type Values

max_width

array
0%
xs
sm
md
lg
xl
xxl
0
none
100%

min_width

array
0%
xs
sm
md
lg
xl
xxl
0
none
100%

width

array
0%
xs
sm
md
lg
xl
xxl
0
none
100%

z_index

array
1
2
3
4
5
6
7
8
9
10

number_spacing

array
tabular

shadow

array
none
deep
deeper
deepest

line_height

array
tightest
tighter
tight
normal
loose
looser
loosest

display

array
block
inline_block
inline
flex
inline_flex
none

cursor

array
auto
default
none
contextMenu
help
pointer
progress
wait
cell
crosshair
text
verticalText
alias
copy
move
noDrop
notAllowed
grab
grabbing
eResize
nResize
neResize
nwResize
sResize
seResize
swResize
wResize
ewResize
nsResize
neswResize
nwseResize
colResize
rowResize
allScroll
zoomIn
zoomOut

flex_direction

array
row
column
rowReverse
columnReverse

flex_wrap

array
wrap
nowrap
wrapReverse

justify_content

array
start
end
center
spaceBetween
spaceAround
spaceEvenly

justify_self

array
auto
start
end
center
stretch

align_items

array
flexStart
flexEnd
start
end
center
baseline
stretch

align_content

array
start
end
center
spaceBetween
spaceAround
spaceEvenly

align_self

array
auto
start
end
center
stretch
baseline

flex

array
auto
initial
0
1
2
3
4
5
6
7
8
9
10
11
12
none

flex_grow

array
1
0

flex_shrink

array
1
0

order

array
1
2
3
4
5
6
7
8
9
10
11
12

position

array
relative
absolute
fixed
sticky

hover

array

border_radius

array
none
xs
sm
md
lg
xl
rounded

text_align

array
start
end
left
right
center
justify
justify-all
match-parent

overflow

array
visible
hidden
scroll
auto

truncate

array
1
2
3
4
5

left

array
0
xxs
xs
sm
md
lg
xl
auto
initial
inherit

top

array
0
xxs
xs
sm
md
lg
xl
auto
initial
inherit

right

array
0
xxs
xs
sm
md
lg
xl
auto
initial
inherit

bottom

array
0
xxs
xs
sm
md
lg
xl
auto
initial
inherit

vertical_align

array
baseline
super
top
middle
bottom
sub
text-top
text-bottom

height

array
auto
xs
sm
md
lg
xl
xxl
xxxl

min_height

array
auto
xs
sm
md
lg
xl
xxl
xxxl

max_height

array
auto
xs
sm
md
lg
xl
xxl
xxxl

overflow_x

array
visible
hidden
scroll
auto

overflow_y

array
visible
hidden
scroll
auto

margin

array
none
xxs
xs
sm
md
lg
xl

margin_bottom

array
none
xxs
xs
sm
md
lg
xl

margin_left

array
none
xxs
xs
sm
md
lg
xl

margin_right

array
none
xxs
xs
sm
md
lg
xl

margin_top

array
none
xxs
xs
sm
md
lg
xl

margin_x

array
none
xxs
xs
sm
md
lg
xl

margin_y

array
none
xxs
xs
sm
md
lg
xl

padding

array
none
xxs
xs
sm
md
lg
xl

padding_bottom

array
none
xxs
xs
sm
md
lg
xl

padding_left

array
none
xxs
xs
sm
md
lg
xl

padding_right

array
none
xxs
xs
sm
md
lg
xl

padding_top

array
none
xxs
xs
sm
md
lg
xl

padding_x

array
none
xxs
xs
sm
md
lg
xl

padding_y

array
none
xxs
xs
sm
md
lg
xl

classname

string

dark

boolean

group_hover

boolean

data

hashprop

aria

hashprop

html_options

hashprop

children

proc

style

hashprop
Props Type Values Default

id

string

name

string

tree_data

array

return_all_selected

boolean
false

selected_ids

array

input_display

enum
pills
none
pills

input_name

string

variant

enum
multi
single
multi

pill_color

enum
primary
neutral
success
warning
error
info
data_1
data_2
data_3
data_4
data_5
data_6
data_7
data_8
windows
siding
roofing
doors
gutters
solar
insulation
accessories
primary