Skip to content

Power Search

@astryxdesign/core v0.7.1 · PowerSearch

Props ​

NameTypeDefaultDescription
configPowerSearchConfigrequiredFields, operators, and the value each operator expects.
filtersPowerSearchFilter[]-Current filters. When passed, the parent owns them and listens for updates.
labelstringSearchAccessible name of the input.
isLabelHiddenbooleantrueHides the label visually and keeps it available to assistive tech. Omitted means hidden; false shows it. labelHidden is the older name. When both are set, this one wins.
placeholderstringSearch…Placeholder while there are no filters.
autofocusbooleanfalseFocus the input after mount.
hasClearbooleantrueShows clear all once a filter exists. The older clearable name works too.
readOnlybooleanfalseBlocks adding, editing, and removing.
disabledbooleanfalseTurns the whole search off.
disabledMessagestring-Why it is off. With disabled, the message shows in a tooltip on hover or keyboard focus and the input stays focusable with aria-disabled. The older disabledReason name works too.
status'default' | 'success' | 'warning' | 'error'defaultValidation status.
statusMessagestring-Status text.
statusVariant'attached' | 'detached'attachedPlaces the message against the field, or with a gap.
maxTokenLengthnumber40How many characters of a value a token shows.
maxSearchResultsnumber10Ranked field results for a non-empty query. An empty query browses up to 1,000 fields.
maxOperatorMenuItemsnumber10Suggestions in string and entity value editors. It does not cap the field menu or enum menus.
menuWidthnumber-Exact pixel width of the field menu. It does not size the value editor.
popoverSaveButtonLabelstringApplyLabel of the save button in the filter editor popover. The older saveLabel name works too.
timezoneIDstring-Time zone used when a date is shown, such as America/New_York. The older timeZone name works too.
overflow'none' | 'unfocused-inline' | 'unfocused-layer'noneWrap tokens, collapse them on blur, or expand them in a layer.
resultCountnumber | string-Match count. A number is formatted with the result plural. A string is shown as given.
size'sm' | 'md' | 'lg'mdSize of the input and the tokens.
componentsPowerSearchComponents-Replace the token or the editor for one value type.
containerClassstring-Added to the field shell, the layer that holds the label and the status message. It does not land on the bordered box or the native input.
containerStyleStyleValue-Inline style for the field shell. Same landing as containerClass.
controlClassstring-Added to the bordered box. A class on the component lands there too, not on the native input.
controlStyleStyleValue-Inline style for the bordered box. A style on the component lands there too.

Events ​

NamePayloadDescription
update:filtersthe next filtersFilters changed. Use it with the two-way binding.
changefilters, change type, indexThe type is add, edit, or remove. The index is the filter that changed.
focusfocus eventFocus entered the input.
blurfocus eventFocus left the input.

Slots ​

The icon sits before the tokens. endContent (also accepted as end) sits before the clear button and is the place for another action. The token and editor slots win over a component registered for a value type.

The component also exposes focus and blur methods, so a button outside the field can send the cursor back.

Field definitions ​

createPowerSearchConfig accepts string, number, boolean, date, enum, enum list, and string list. Strings can contain, start with, end with, or equal a value. Numbers compare magnitude. Dates can be before, after, or between. A boolean does not ask for another value.

A hand-written config can also use time, a relative date, an entity list, a custom editor, and nested filters. A custom editor needs a way to read the value back as text.