--- title: "Query Filter" slug: query-filter category: component type: examples version: 20.0.0 tokens: 819 source: https://ovh.github.io/design-system/v20.0.0/llms/react-components-query-filter--examples.txt --- # Query Filter ## Default ```tsx { const filterProperty = useMemo(() => ({ label: 'Properties', options: [ { label: 'Instance ID', value: 'instance-id' }, { label: 'States', value: 'states' }, ], }), []); const filterOption = useMemo(() => ({ ['instance-id']: { operator: { label: 'Operators I', options: [ { label: 'equals', value: '=' }, { label: 'does not equal', value: '!=' }, ], }, value: { label: 'Instance Values', options: [ { label: 'instance 1', value: 'instance-1' }, { label: 'instance 2', value: 'instance-2' }, ], }, }, states: { operator: { label: 'Operators S', options: [ { label: 'equals', value: '=' }, { label: 'does not equal', value: '!=' }, ], }, value: { label: 'State Values', options: [ { label: 'Running', value: 'running' }, { label: 'Stopped', value: 'stopped' }, ], }, } }), []); return ( Clear all ); } ``` ## Accessibility Form Field ```tsx { const filterProperty = useMemo(() => ({ label: 'Properties', options: [{ label: 'States', value: 'states' }], }), []); const filterOption = useMemo(() => ({ states: { operator: { label: 'Operators', options: [{ label: 'equals', value: '=' }], }, value: { label: 'State Values', options: [ { label: 'Running', value: 'running' }, { label: 'Stopped', value: 'stopped' }, ], }, }, }), []); return ( Filter instances: ); } ``` ## Accessibility Aria Label ```tsx { const filterProperty = useMemo(() => ({ label: 'Properties', options: [{ label: 'States', value: 'states' }], }), []); const filterOption = useMemo(() => ({ states: { operator: { label: 'Operators', options: [{ label: 'equals', value: '=' }], }, value: { label: 'State Values', options: [ { label: 'Running', value: 'running' }, { label: 'Stopped', value: 'stopped' }, ], }, }, }), []); return ( ); } ```