Class: BlazeDropdown
ui/dropdown.BlazeDropdown
Hierarchy
BlazeElement<HTMLDivElement>โณ
BlazeDropdown
Constructors
constructor
โข new BlazeDropdown(selected, options, size)
Create a BlazeDropdown.
Parameters
| Name | Type | Description |
|---|---|---|
selected | string | The initially selected option |
options | string[] | The options in the dropdown |
size | number | The dropdown's font size in rem units |
Overrides
Defined in
src/ui/dropdown.ts:27
Properties
element
โข Readonly element: HTMLDivElement
Inherited from
Defined in
src/ui/element.ts:9
keys
โข Readonly keys: KeyboardHandler
Inherited from
Defined in
src/ui/element.ts:11
label
โข Private label: BlazeText<HTMLParagraphElement>
Defined in
src/ui/dropdown.ts:13
mouse
โข Readonly mouse: MouseHandler
Inherited from
Defined in
src/ui/element.ts:10
onSelect
โข onSelect: (selected: string) => void
Type declaration
โธ (selected): void
Callback that is called whenever the dropdown's selected option changes.
Parameters
| Name | Type |
|---|---|
selected | string |
Returns
void
Defined in
src/ui/dropdown.ts:18
options
โข Private options: string[]
Defined in
src/ui/dropdown.ts:10
select
โข Private select: HTMLSelectElement
Defined in
src/ui/dropdown.ts:12
selected
โข Private selected: string
Defined in
src/ui/dropdown.ts:9
size
โข Private size: number
Defined in
src/ui/dropdown.ts:7
touch
โข Readonly touch: TouchHandler
Inherited from
Defined in
src/ui/element.ts:12
Methods
addLabel
โธ addLabel(label, aside?): void
Add a label above or to the side of the input.
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
label | string | undefined | The label's text |
aside | boolean | false | Wether the label is above or to the side of the input |
Returns
void
Defined in
src/ui/dropdown.ts:129
addOption
โธ addOption(option): void
Adds an option to the dropdown.
Parameters
| Name | Type | Description |
|---|---|---|
option | string | The option to add |
Returns
void
Defined in
src/ui/dropdown.ts:99
getOptions
โธ getOptions(): string[]
Gets the dropdown's options.
Returns
string[]
The dropdown's options
Defined in
src/ui/dropdown.ts:90
getSelected
โธ getSelected(): string
Gets the dropdown's currently selected option.
Returns
string
The dropdown's currently selected option
Defined in
src/ui/dropdown.ts:63
getSize
โธ getSize(): number
Gets the dropdown's font size.
Returns
number
The dropdown's font size in rem units
Defined in
src/ui/dropdown.ts:119
removeLabel
โธ removeLabel(): void
Remove the input's label.
Returns
void
Defined in
src/ui/dropdown.ts:148
setOptions
โธ setOptions(options): void
Sets the options in the dropdown.
Parameters
| Name | Type | Description |
|---|---|---|
options | string[] | The dropdown's new options |
Returns
void
Defined in
src/ui/dropdown.ts:72
setSelected
โธ setSelected(selected): void
Sets the dropdown's selected option.
Parameters
| Name | Type | Description |
|---|---|---|
selected | string | The dropdown's new selected option |
Returns
void
Defined in
src/ui/dropdown.ts:51
setSize
โธ setSize(size): void
Sets the dropdown's font size.
Parameters
| Name | Type | Description |
|---|---|---|
size | number | The dropdown's font size in rem units |
Returns
void
Defined in
src/ui/dropdown.ts:109