Skip to content
On this page

Search

Basic search.

Usage

Import

ts
import { Asearch } from "@agufaui/${framework name}";

Html

<asearch /> or <Asearch />

Configuration

Theme component name: asearch

Showcase

  • default maxlength is 255
  • For Vue v-model, need to use v-model:v="variable"
Click to see code
vue
<asearch
	v-model:v="text"
	vc="dark:text-white"
	@update:v="text = $event"
	@search="notify"
></asearch>
<asearch
	v-model:v="text2"
	t="inlineblock"
	:disabled="true"
	vc="dark:text-white"
	@update:v="text = $event"
	@search="notify"
>
</asearch>

AgufaUI provided Theme

CDefaultType is just string constant "default"

ts
import { CDefaultType, CUseType } from "@agufaui/config";
import type { IASearchProps } from "../../types/basic/ASearch";

export const DASearchDefault = {
	vc: "block w-full bg-white rounded-md ring-1.5 ring-blue-3 shadow-md py-2 pl-3 pr-10 text-sm placeholder-gray-5 focus:(ring-0 text-gray-9 placeholder-gray-4 outline outline-blue-3)",
	iconc: "text-green-4 hover:text-green-5",
	icondc: "text-gray-4 hover:text-gray-5",
};

export const DASearchInlineBlock = {
	[CUseType]: CDefaultType,
	display: "inline-block",
};

export const DASearch: Readonly<Record<string, Partial<IASearchProps>>> = {
	[CDefaultType]: DASearchDefault,
	inlineblock: DASearchInlineBlock,
};

Attributes (Properties)

Default Values

vue
display: "block",
i: "i-material-symbols:search-sharp",

Unique

ts
export interface IASearchProps extends IProps, IPropsIcon, IPropsForm {
	v?: string; // search text.  Not configurable
	id?: string; // html element search 'id' and 'name' value, html element label 'for' value
	display?: string; // display class for root div html element
	vc?: string; // css classes for search 'input' html element
	iconc?: string; // css classes for search icon if input is not empty
	icondc?: string; // css classes for search icon if input is empty
}

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 IASearchEmits {
	(e: "update:v", modelValue: string): void; // input event
	(e: "search", modelValue: string): void; // search event
}

Released under the MIT License.