Skip to content

Filter is a filtering component where a user can filter through data to get customized search results.

Overview

Filter is a useful utility component which can house large amounts of data. Users can interact with the data most relevant to their workflow without having all data load on initialization, allowing your application to load faster and be more accessible to wider audiences.

Visit the Filter recent earthquakes tutorial to view an application of the Filter component.

Usage

  • Limit large data from loading on initialization
  • Enable your user to navigate through data

API reference

Properties

PropertyAttributeDescriptionTypeDefault
disableddisabledWhen true, prevents interaction and decreases the component's opacity.booleanfalse
filteredItemsread-onlyThe component's resulting items after filtering.object[]
filterPropsWhen value is an object, specifies the properties to match against when filtering. If not set, all properties will be matched.string[] | undefined
itemsSpecifies the items to filter. The component uses the values as the starting point, and returns items that contain the string entered in the input, using a partial match and recursive search. This property is needed to conduct filtering.object[]
labellabelSpecifies an accessible label for the component.string | undefined
messageOverridesOverrides individual strings used by the component.Record<string, unknown> | undefined
placeholderplaceholderSpecifies the component's input placeholder text.string | undefined
scalescaleSpecifies the size of the component.Scale"m"
valuevalueThe component's value.string

Styles

NameDescription
--calcite-filter-content-spaceSpecifies the padding of the component's content.
--calcite-filter-input-background-colorSpecifies the component's input background color.
--calcite-filter-input-border-colorSpecifies the component's input border color.
--calcite-filter-input-corner-radiusSpecifies the component's input corner radius.
--calcite-filter-input-shadowSpecifies the component's input shadow.
--calcite-filter-input-icon-colorSpecifies the component's input icon color.
--calcite-filter-input-text-colorSpecifies the component's input text color.
--calcite-filter-input-placeholder-text-colorSpecifies the component's input placeholder text color.
--calcite-filter-input-actions-background-colorSpecifies the background color of the component's input clearable element.
--calcite-filter-input-actions-background-color-hoverSpecifies the background color of the component's input clearable element when hovered.
--calcite-filter-input-actions-background-color-pressSpecifies the background color of the component's input clearable element when pressed.
--calcite-filter-input-actions-icon-colorSpecifies the icon color of the component's input clearable element.
--calcite-filter-input-actions-icon-color-hoverSpecifies the icon color of the component's input clearable element when hovered.
--calcite-filter-input-actions-icon-color-pressSpecifies the icon color of the component's input clearable element when pressed.

Events

NameDescriptionBehavior
calciteFilterChangeFires when the filter text changes.bubblescomposed

Methods

NameDescriptionSignature
componentOnReadyCreate a promise that resolves once component is fully loaded.componentOnReady(): Promise<this>
filterPerforms a filter on the component. This method can be useful because filtering is delayed and asynchronous.filter(value?: string): Promise<void>
setFocusSets focus on the component.setFocus(options?: FocusOptions): Promise<void>

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.