Choices
At a glance
Section titled “At a glance”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
Section titled “NavItem”NavItem :: struct { icon: Icon, label: string,}One destination of a navigation list, with an icon (see Icon).
| Field | Type | Notes |
|---|---|---|
icon | Icon | |
label | string |
Source: kiln/choice.odin:175
Procedure groups
Section titled “Procedure groups”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_indexproc(selected: int, items: []NavItem, collapsed := false) -> (int, bool)nav_enumproc(selected: $E, items: [E]NavItem, collapsed := false) -> (E, bool) where intrinsics.type_is_enum(E)
Source: kiln/choice.odin:182
segmented
Section titled “segmented”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_indexproc(selected: int, labels: []string, fill := false, disabled: []bool = nil) -> (int, bool)segmented_enumproc(selected: $E, labels: [E]string, fill := false, disabled: []bool = nil) -> (E, bool) where intrinsics.type_is_enum(E)
Source: kiln/choice.odin:37
select
Section titled “select”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_indexproc(selected: int, options: []string, placeholder := "", disabled := false, key := "") -> (int, bool)select_enumproc(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_indexproc(selected: int, labels: []string) -> (int, bool)tabs_enumproc(selected: $E, labels: [E]string) -> (E, bool) where intrinsics.type_is_enum(E)
Source: kiln/choice.odin:116
Procedures
Section titled “Procedures”nav_enum
Section titled “nav_enum”nav_enum :: proc( selected: $E, items: [E]NavItem, collapsed := false,) -> (E, bool) where intrinsics.type_is_enum(E)| Argument | Type | Default |
|---|---|---|
selected | $E | required |
items | [E]NavItem | required |
collapsed | bool | false |
| Returns | Type |
|---|---|
| #0 | E |
| #1 | bool |
Source: kiln/choice.odin:239
nav_index
Section titled “nav_index”nav_index :: proc(selected: int, items: []NavItem, collapsed := false) -> (int, bool)| Argument | Type | Default |
|---|---|---|
selected | int | required |
items | []NavItem | required |
collapsed | bool | false |
| Returns | Type |
|---|---|
| #0 | int |
| #1 | bool |
Source: kiln/choice.odin:187
segmented_enum
Section titled “segmented_enum”segmented_enum :: proc( selected: $E, labels: [E]string, fill := false, disabled: []bool = nil,) -> (E, bool) where intrinsics.type_is_enum(E)| Argument | Type | Default |
|---|---|---|
selected | $E | required |
labels | [E]string | required |
fill | bool | false |
disabled | []bool | nil |
| Returns | Type |
|---|---|
| #0 | E |
| #1 | bool |
Source: kiln/choice.odin:96
segmented_index
Section titled “segmented_index”segmented_index :: proc( selected: int, labels: []string, fill := false, disabled: []bool = nil,) -> (int, bool)| Argument | Type | Default |
|---|---|---|
selected | int | required |
labels | []string | required |
fill | bool | false |
disabled | []bool | nil |
| Returns | Type |
|---|---|
| #0 | int |
| #1 | bool |
Source: kiln/choice.odin:42
select_enum
Section titled “select_enum”select_enum :: proc( selected: $E, options: [E]string, placeholder := "", disabled := false, key := "",) -> (E, bool) where intrinsics.type_is_enum(E)| Argument | Type | Default |
|---|---|---|
selected | $E | required |
options | [E]string | required |
placeholder | string | "" |
disabled | bool | false |
key | string | "" |
| Returns | Type |
|---|---|
| #0 | E |
| #1 | bool |
Source: kiln/choice.odin:322
select_index
Section titled “select_index”select_index :: proc( selected: int, options: []string, placeholder := "", disabled := false, key := "",) -> (int, bool)| Argument | Type | Default |
|---|---|---|
selected | int | required |
options | []string | required |
placeholder | string | "" |
disabled | bool | false |
key | string | "" |
| Returns | Type |
|---|---|
| #0 | int |
| #1 | bool |
Source: kiln/choice.odin:266
tabs_enum
Section titled “tabs_enum”tabs_enum :: proc(selected: $E, labels: [E]string) -> (E, bool) where intrinsics.type_is_enum(E)| Argument | Type | Default |
|---|---|---|
selected | $E | required |
labels | [E]string | required |
| Returns | Type |
|---|---|
| #0 | E |
| #1 | bool |
Source: kiln/choice.odin:164
tabs_index
Section titled “tabs_index”tabs_index :: proc(selected: int, labels: []string) -> (int, bool)| Argument | Type | Default |
|---|---|---|
selected | int | required |
labels | []string | required |
| Returns | Type |
|---|---|
| #0 | int |
| #1 | bool |
Source: kiln/choice.odin:121