Select
Basic select.
Usage
Import
ts
import { Aselect, Aselectoption } from "@agufaui/${framework name}";
Html
<aselect /> or <Aselect /> <aselectoption /> or <Aselectoption />
Configuration
Theme component name: aselect
Theme component name: aselectoption
Showcase
- component Aselect
Click to see code
vue
<aselect
:v="selected"
label="country"
:fullwidth="true"
:options="options"
@select="assign(selected, $event)"
>
</aselect>
<aselect
:v="selected1"
label="country"
t="green"
:fullwidth="true"
:options="options"
@select="assign(selected1, $event)"
>
</aselect>
<aselect :v="selected2" label="disabled" :fullwidth="true" :options="options" :disabled="true">
</aselect>- component Aselectoption
Click to see code
vue
<aselectoption :v="selected" :options="options" vc="w-15rem" @select="selected = $event">
</aselectoption>
<aselectoption :v="selected1" nolabel :options="options" @select="selected1 = $event">
</aselectoption>
<aselectoption :v="selected2" :options="options" :disabled="true"> </aselectoption>AgufaUI provided Theme
CDefaultType is just string constant "default"
ts
import { CDefaultType, CUseType } from "@agufaui/config";
import type { IASelectProps, IASelectoptionProps } from "../../types/basic/ASelect";
export const DASelectDefault = {
labelc: "text-gray-7",
buttonc: "focus:(ring-blue-2 outline-blue-3)",
ic: "text-gray-4",
optionc: "hover:text-white hover:bg-blue-6 text-gray-9",
selectedc: "text-white bg-blue-6",
checkc: "text-blue-6",
};
export const DASelectGreen = {
[CUseType]: CDefaultType,
buttonc: "r@ focus:ring-green-2 r@ focus:outline-green-3",
optionc: "r@ hover:bg-green-6",
selectedc: "r@ bg-green-6",
checkc: "r@ text-green-6",
};
export const DASelect: Readonly<Record<string, Partial<IASelectProps>>> = {
[CDefaultType]: DASelectDefault,
green: DASelectGreen,
};
export const DASelectoptionDefault = {
labelc: "text-gray-7 sm:mr-2",
vc: "pl-3 pr-10 py-2 text-base rounded-md outline outline-gray-3 focus:(outline-none ring ring-blue-5 focus:outline-blue-5)",
};
export const DASelectoption: Readonly<Record<string, Partial<IASelectoptionProps>>> = {
[CDefaultType]: DASelectoptionDefault,
};
Slot
component Aselectoption
- One default slot for label.
- one named slot
initSelectoptionfor display when no option is selected
Attributes (Properties)
Default Values
- component Aselect
vue
i: "i-heroicons:chevron-up-down-solid",- component Aselectoption
vue
Unique
ts
export type TSelectOption = {
id: string | number;
name: string;
display?: string;
};
export interface IASelectProps extends IProps, IPropsIcon, IPropsForm {
label?: string; // label. Not configurable
labelc?: string; // css classes for label html element
buttonc?: string; // css classes for button
options: TSelectOption[]; //options. Not configurable
v: TSelectOption; // selected option. Not configurable
vc?: string; // css classes for options
id?: string; // select group id
fullwidth?: boolean; // whether options panel full width or fit content
displayc?: string; // css classes for option display
optionc?: string; // css classes for option container 'div' html element
selectedc?: string; // css classes for 'div' html element when selected
checkc?: string; // css classes for check icon when selected
}
export interface IASelectoptionProps extends IProps, IPropsForm {
nolabel?: boolean; // no label
labelc?: string; // css classes for label html element
options: TSelectOption[]; //options. Not configurable
v: string | number; // selected option id. Not configurable
vc?: string; // css classes for options
id?: string; // select group id
optionc?: string; // css classes for each 'option' html element
}Inherit from IProps
ts
export interface IProps {
t?: string; // user defined or AgufaUI provided component type. Not configurable
c?: string; // css classes for component root html element
}Inherit from IPropsIcon
- component Aselect
ts
export type TLRPosition = "left" | "right";
export interface IPropsIcon {
i?: string; // icon eg. i-eos-icons:loading
ipos?: TLRPosition; // icon position
ic?: string; // css classes for icon element
}Inherit from IPropsForm
ts
export interface IPropsForm {
disabled?: boolean; // disabled
}Events
ts
export interface IASelectEmits {
(e: "select", option: TSelectOption): void; // select event
}
export interface IASelectoptionEmits {
(e: "select", id: string | number): void; // select event
}