Skip to content

Choices

NavItem :: struct {...}
nav :: proc{nav_index, nav_enum}
segmented :: proc{segmented_index, segmented_enum}
select :: proc{select_index, select_enum}
tabs :: proc{tabs_index, tabs_enum}
nav_enum :: proc(selected: $E, items: [E]NavItem, collapsed := false) -> (E, bool) where intrinsics.type_is_enum(E)
nav_index :: proc(selected: int, items: []NavItem, collapsed := false) -> (int, bool)
segmented_enum :: proc(selected: $E, labels: [E]string, fill := false, disabled: []bool = nil) -> (E, bool) where intrinsics.type_is_enum(E)
segmented_index :: proc(selected: int, labels: []string, fill := false, disabled: []bool = nil) -> (int, bool)
select_enum :: proc(selected: $E, options: [E]string, placeholder := "", disabled := false, key := "") -> (E, bool) where intrinsics.type_is_enum(E)
select_index :: proc(selected: int, options: []string, placeholder := "", disabled := false, key := "") -> (int, bool)
tabs_enum :: proc(selected: $E, labels: [E]string) -> (E, bool) where intrinsics.type_is_enum(E)
tabs_index :: proc(selected: int, labels: []string) -> (int, bool)
NavItem :: struct {
icon: Icon,
label: string,
}

One destination of a navigation list, with an icon (see Icon).

FieldTypeNotes
iconIcon
labelstring

Source: kiln/choice.odin:175

nav :: proc{nav_index, nav_enum}

A vertical list of destinations (sidebars, drawers). collapsed shows only the icons, with the label as tooltip, for narrow navigation rails.

Calls one of these, depending on the argument types:

  • nav_index proc(selected: int, items: []NavItem, collapsed := false) -> (int, bool)
  • nav_enum proc(selected: $E, items: [E]NavItem, collapsed := false) -> (E, bool) where intrinsics.type_is_enum(E)

Source: kiln/choice.odin:182

segmented :: proc{segmented_index, segmented_enum}

A pill-shaped row of joined options for switching between a few modes. fill stretches it (and its segments, equally) to the width of the container. Options can be disabled one by one with disabled[i] (for enums in the order of the enum values).

Calls one of these, depending on the argument types:

  • segmented_index proc(selected: int, labels: []string, fill := false, disabled: []bool = nil) -> (int, bool)
  • segmented_enum proc(selected: $E, labels: [E]string, fill := false, disabled: []bool = nil) -> (E, bool) where intrinsics.type_is_enum(E)

Source: kiln/choice.odin:37

select :: proc{select_index, select_enum}

A dropdown. selected is -1 (or out of range) while nothing is chosen; then the placeholder is shown. The list opens below the field, or above it when there is no room below.

Calls one of these, depending on the argument types:

  • select_index proc(selected: int, options: []string, placeholder := "", disabled := false, key := "") -> (int, bool)
  • select_enum proc(selected: $E, options: [E]string, placeholder := "", disabled := false, key := "") -> (E, bool) where intrinsics.type_is_enum(E)

Source: kiln/choice.odin:261

tabs :: proc{tabs_index, tabs_enum}

A tab bar with an underline on the selected tab. Showing the matching content is up to the caller (a switch on the selection).

Calls one of these, depending on the argument types:

  • tabs_index proc(selected: int, labels: []string) -> (int, bool)
  • tabs_enum proc(selected: $E, labels: [E]string) -> (E, bool) where intrinsics.type_is_enum(E)

Source: kiln/choice.odin:116

nav_enum :: proc(
selected: $E,
items: [E]NavItem,
collapsed := false,
) -> (E, bool) where intrinsics.type_is_enum(E)
ArgumentTypeDefault
selected$Erequired
items[E]NavItemrequired
collapsedboolfalse
ReturnsType
#0E
#1bool

Source: kiln/choice.odin:239

nav_index :: proc(selected: int, items: []NavItem, collapsed := false) -> (int, bool)
ArgumentTypeDefault
selectedintrequired
items[]NavItemrequired
collapsedboolfalse
ReturnsType
#0int
#1bool

Source: kiln/choice.odin:187

segmented_enum :: proc(
selected: $E,
labels: [E]string,
fill := false,
disabled: []bool = nil,
) -> (E, bool) where intrinsics.type_is_enum(E)
ArgumentTypeDefault
selected$Erequired
labels[E]stringrequired
fillboolfalse
disabled[]boolnil
ReturnsType
#0E
#1bool

Source: kiln/choice.odin:96

segmented_index :: proc(
selected: int,
labels: []string,
fill := false,
disabled: []bool = nil,
) -> (int, bool)
ArgumentTypeDefault
selectedintrequired
labels[]stringrequired
fillboolfalse
disabled[]boolnil
ReturnsType
#0int
#1bool

Source: kiln/choice.odin:42

select_enum :: proc(
selected: $E,
options: [E]string,
placeholder := "",
disabled := false,
key := "",
) -> (E, bool) where intrinsics.type_is_enum(E)
ArgumentTypeDefault
selected$Erequired
options[E]stringrequired
placeholderstring""
disabledboolfalse
keystring""
ReturnsType
#0E
#1bool

Source: kiln/choice.odin:322

select_index :: proc(
selected: int,
options: []string,
placeholder := "",
disabled := false,
key := "",
) -> (int, bool)
ArgumentTypeDefault
selectedintrequired
options[]stringrequired
placeholderstring""
disabledboolfalse
keystring""
ReturnsType
#0int
#1bool

Source: kiln/choice.odin:266

tabs_enum :: proc(selected: $E, labels: [E]string) -> (E, bool) where intrinsics.type_is_enum(E)
ArgumentTypeDefault
selected$Erequired
labels[E]stringrequired
ReturnsType
#0E
#1bool

Source: kiln/choice.odin:164

tabs_index :: proc(selected: int, labels: []string) -> (int, bool)
ArgumentTypeDefault
selectedintrequired
labels[]stringrequired
ReturnsType
#0int
#1bool

Source: kiln/choice.odin:121