Checkbox
Basic checkbox.
Usage
Import
ts
import { Acheckbox } from "@agufaui/${framework name}";
Html
<acheckbox /> or <Acheckbox />
Configuration
Theme component name: acheckbox
Showcase
Click to see code
vue
<acheckbox :v="checked" t="green" @click="checked = !checked"> </acheckbox>
<acheckbox
:v="checked1"
i="i-ic:baseline-minus"
vc="text-blue-5 focus:ring-blue-3 hover:outline-blue-2"
>
</acheckbox>
<acheckbox :v="checked2" :disabled="true"> </acheckbox>Slot
One default slot replace label.
AgufaUI provided Theme
CDefaultType is just string constant "default"
ts
import { CDefaultType, CUseType } from "@agufaui/config";
import type { IACheckboxProps } from "../../types/basic/ACheckbox";
export const DACheckboxDefault = {
vc: "bg-white outline-gray-2 outline rounded-sm h-5 w-5",
ic: "text-white",
};
export const DACheckboxGreen = {
[CUseType]: CDefaultType,
vc: "text-green-5 focus:ring-green-3 hover:outline-green-2 peer-checked:ring-green-3",
};
export const DACheckboxBlue = {
[CUseType]: CDefaultType,
vc: "text-blue-5 focus:ring-blue-3 hover:outline-blue-2 peer-checked:ring-blue-3",
};
export const DACheckbox: Readonly<Record<string, Partial<IACheckboxProps>>> = {
[CDefaultType]: DACheckboxDefault,
green: DACheckboxGreen,
blue: DACheckboxBlue,
};
Attributes (Properties)
Default Values
vue
i: "i-ic:baseline-check",Unique
ts
export interface IACheckboxProps extends IProps, IPropsIcon, IPropsForm {
v?: boolean; // if checked. Not configurable
vc?: string; // css classes for div html element
label?: string; // Not configurable
inputc?: string; // css classes for 'input' 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
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 IACheckboxEmits {
(e: "click", event: MouseEvent): void; // click event
}