Skip to content

The open alternative to Salesforce, designed for AI.

Simplify SearchInput slots (#28023)

Raphaël Bosi17ab3eccb524
diff --git a/packages/twenty-docs/snippets/ui/generated/components/input/search-input.mdx b/packages/twenty-docs/snippets/ui/generated/components/input/search-input.mdx
index f50b86af003..34b96c43ff5 100644
--- a/packages/twenty-docs/snippets/ui/generated/components/input/search-input.mdx
+++ b/packages/twenty-docs/snippets/ui/generated/components/input/search-input.mdx
@@ -11,6 +11,10 @@
* npx nx generate:ui twenty-docs
*/}
+<ParamField body="actions" type="ReactNode">
+ Controls rendered after the search field, such as a filter Dropdown. Set their size and accessible names on the controls.
+</ParamField>
+
<ParamField body="aria-label" type="string">
Accessible name when aria-labelledby is absent.
</ParamField>
@@ -32,15 +36,7 @@
</ParamField>
<ParamField body="disabled" type="boolean">
- Disables the text input. Configure filter popup controls separately.
-</ParamField>
-
-<ParamField body="filterButtonAriaLabel" type="string" default="Filter">
- Accessible label for the optional filter button.
-</ParamField>
-
-<ParamField body="filterDropdown" type="((filterButton: ReactElement&lt;unknown, string | JSXElementConstructor&lt;any&gt;&gt;) =&gt; ReactNode)">
- Renders a filter popup around the supplied filter button.
+ Disables the text input. Controls in actions keep their own state.
</ParamField>
<ParamField body="id" type="string">
@@ -71,7 +67,7 @@
</ParamField>
<ParamField body="size" type="&quot;md&quot; | &quot;sm&quot;" default="md">
- Visual size of the input group and optional filter button.
+ Visual size of the input group.
</ParamField>
<ParamField body="style" type="CSSProperties | ((state: InputState) =&gt; CSSProperties | undefined)">
diff --git a/packages/twenty-docs/ui/components/input/search-input.mdx b/packages/twenty-docs/ui/components/input/search-input.mdx
index 64f816724c4..93072829930 100644
--- a/packages/twenty-docs/ui/components/input/search-input.mdx
+++ b/packages/twenty-docs/ui/components/input/search-input.mdx
@@ -1,6 +1,6 @@
---
title: SearchInput
-description: Controlled search text with an optional filter popup.
+description: Controlled search text with optional actions, such as a filter popup.
---
import { StoryEmbed } from '/snippets/ui/StoryEmbed.mdx';
@@ -26,7 +26,7 @@ export const PeopleSearch = () => {
};
```
-Use `aria-label` or `aria-labelledby` for an accessible name. `filterDropdown` receives a filter button that you can compose with a [Dropdown](/ui/components/navigation/dropdown) trigger using `render`. Supply `filterButtonAriaLabel` to name that action. `disabled` disables the text input; configure the optional filter controls separately.
+Use `aria-label` or `aria-labelledby` for an accessible name.
<StoryEmbed
storyId="ui-input-searchinput--default"
@@ -34,7 +34,62 @@ Use `aria-label` or `aria-labelledby` for an accessible name. `filterDropdown` r
height={280}
/>
-Native input props, `className`, `style`, and `ref` apply to the input itself. The shared `InputGroup` owns the search adornment and focus treatment. Use `size="sm"` for a compact search field.
+Native input props, `className`, `style`, and `ref` apply to the input itself. The shared `InputGroup` owns the search adornment and focus treatment. The wrapper that lays out the field and its actions takes no props; place `SearchInput` in your own container to size or position it. Use `size="sm"` for a compact search field.
+
+## Actions
+
+`actions` renders controls after the search field. Compose a filter popup with a [Dropdown](/ui/components/navigation/dropdown) whose trigger is an `IconButton`, and give that button an accessible name.
+
+```tsx
+import { useState } from 'react';
+import { IconButton, SearchInput } from 'twenty-ui/components/input';
+import { Dropdown } from 'twenty-ui/components/navigation';
+import { SettingsRow } from 'twenty-ui/components/settings';
+import { IconFilter } from 'twenty-ui/icon';
+
+export const FilteredPeopleSearch = () => {
+ const [search, setSearch] = useState('');
+ const [includeInactive, setIncludeInactive] = useState(false);
+
+ return (
+ <SearchInput
+ aria-label="Search people"
+ placeholder="Name or email"
+ value={search}
+ onValueChange={setSearch}
+ actions={
+ <Dropdown.Root type="panel">
+ <Dropdown.Trigger
+ render={
+ <IconButton aria-label="Filter people">
+ <IconFilter />
+ </IconButton>
+ }
+ />
+ <Dropdown.Content align="end">
+ <Dropdown.Section>
+ <SettingsRow
+ checked={includeInactive}
+ onCheckedChange={setIncludeInactive}
+ >
+ Include inactive people
+ </SettingsRow>
+ </Dropdown.Section>
+ </Dropdown.Content>
+ </Dropdown.Root>
+ }
+ />
+ );
+};
+```
+
+`disabled` disables only the text input; disable action controls separately. With `size="sm"`, pass `size="sm"` to the action controls as well.
+
+<StoryEmbed
+ storyId="ui-input-searchinput--with-filter"
+ title="SearchInput with a filter popup"
+ height={320}
+/>
## Props
diff --git a/packages/twenty-front/src/modules/settings/admin-panel/apps/components/SettingsAdminApps.tsx b/packages/twenty-front/src/modules/settings/admin-panel/apps/components/SettingsAdminApps.tsx
index 53355414e71..408f08124a4 100644
--- a/packages/twenty-front/src/modules/settings/admin-panel/apps/components/SettingsAdminApps.tsx
+++ b/packages/twenty-front/src/modules/settings/admin-panel/apps/components/SettingsAdminApps.tsx
@@ -36,6 +36,7 @@ import {
type FindAllApplicationRegistrationsQuery,
SyncMarketplaceCatalogDocument,
} from '~/generated-admin/graphql';
+import { SettingsSearchFilterTrigger } from '@/settings/components/SettingsSearchFilterTrigger';
type AdminApplicationRegistration =
FindAllApplicationRegistrationsQuery['findAllApplicationRegistrations']['registrations'][number];
@@ -187,12 +188,12 @@ export const SettingsAdminApps = () => {
placeholder={t`Search registrations...`}
value={searchQuery}
onValueChange={setSearchQuery}
- filterDropdown={(filterButton) => (
+ actions={
<DropdownRoot
dropdownId="settings-admin-apps-filter-dropdown"
type="panel"
>
- <Dropdown.Trigger render={filterButton} />
+ <SettingsSearchFilterTrigger />
<DropdownContent align="end" sideOffset={8}>
<Dropdown.Section>
<SettingsRow
@@ -252,7 +253,7 @@ export const SettingsAdminApps = () => {
</Dropdown.Section>
</DropdownContent>
</DropdownRoot>
- )}
+ }
/>
{loading && registrations.length === 0 ? (
<SettingsEmptyPlaceholder>{t`Loading apps...`}</SettingsEmptyPlaceholder>
diff --git a/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingLimitsFilterDropdown.tsx b/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingLimitsFilterDropdown.tsx
index e41f8959ae8..edf067bc826 100644
--- a/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingLimitsFilterDropdown.tsx
+++ b/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingLimitsFilterDropdown.tsx
@@ -1,6 +1,5 @@
import { SelectOptionIcon } from '@/ui/input/components/SelectOptionIcon';
import { useLingui } from '@lingui/react/macro';
-import { type ReactElement } from 'react';
import { isDefined } from 'twenty-shared/utils';
import { IconCoins, IconList, IconTrash, IconUsers } from 'twenty-ui/icon';
@@ -14,11 +13,11 @@ import { DropdownRoot } from '@/ui/layout/dropdown/components/DropdownRoot';
import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent';
import { Dropdown } from 'twenty-ui/components/navigation';
import { type UsageResourceType } from '~/generated-metadata/graphql';
+import { SettingsSearchFilterTrigger } from '@/settings/components/SettingsSearchFilterTrigger';
const FILTER_DROPDOWN_ID = 'settings-billing-limits-filter';
type SettingsBillingLimitsFilterDropdownProps = {
- filterButton: ReactElement;
resourceTypes: UsageResourceType[];
spenderTypes: string[];
selectedResourceType: UsageResourceType | null;
@@ -28,7 +27,6 @@ type SettingsBillingLimitsFilterDropdownProps = {
};
export const SettingsBillingLimitsFilterDropdown = ({
- filterButton,
resourceTypes,
spenderTypes,
selectedResourceType,
@@ -157,7 +155,7 @@ export const SettingsBillingLimitsFilterDropdown = ({
return (
<DropdownRoot dropdownId={FILTER_DROPDOWN_ID} type="picker">
- <Dropdown.Trigger render={filterButton} />
+ <SettingsSearchFilterTrigger ariaLabel={t`Filter limits`} />
<DropdownContent align="end" sideOffset={8}>
<Dropdown.Page id="root">{renderMenuContent()}</Dropdown.Page>
<Dropdown.Page id="usage">{renderUsageContent()}</Dropdown.Page>
diff --git a/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingLimitsTable.tsx b/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingLimitsTable.tsx
index 342e4821e93..447a319e97b 100644
--- a/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingLimitsTable.tsx
+++ b/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingLimitsTable.tsx
@@ -213,10 +213,8 @@ export const SettingsBillingLimitsTable = ({
placeholder={t`Search a limit`}
value={searchText}
onValueChange={setSearchText}
- filterButtonAriaLabel={t`Filter limits`}
- filterDropdown={(filterButton) => (
+ actions={
<SettingsBillingLimitsFilterDropdown
- filterButton={filterButton}
resourceTypes={resourceTypes}
spenderTypes={spenderTypes}
selectedResourceType={resourceType}
@@ -224,7 +222,7 @@ export const SettingsBillingLimitsTable = ({
onSelectResourceType={setResourceType}
onSelectSpenderType={setSpenderType}
/>
- )}
+ }
/>
</StyledToolbar>
}
diff --git a/packages/twenty-front/src/modules/settings/billing/components/__stories__/SettingsBillingLimitsFilterDropdown.stories.tsx b/packages/twenty-front/src/modules/settings/billing/components/__stories__/SettingsBillingLimitsFilterDropdown.stories.tsx
index dc0a03525b3..5281838351b 100644
--- a/packages/twenty-front/src/modules/settings/billing/components/__stories__/SettingsBillingLimitsFilterDropdown.stories.tsx
+++ b/packages/twenty-front/src/modules/settings/billing/components/__stories__/SettingsBillingLimitsFilterDropdown.stories.tsx
@@ -2,7 +2,6 @@ import { SettingsBillingLimitsFilterDropdown } from '@/settings/billing/componen
import { type Meta, type StoryObj } from '@storybook/react-vite';
import { useState } from 'react';
import { expect, userEvent, waitFor, within } from 'storybook/test';
-import { Button } from 'twenty-ui/primitives/input';
import { ComponentDecorator } from 'twenty-ui/testing';
import { UsageResourceType } from '~/generated-metadata/graphql';
@@ -11,7 +10,6 @@ const FilterExample = () => {
const [spender, setSpender] = useState<string | null>(null);
return (
<SettingsBillingLimitsFilterDropdown
- filterButton={<Button>Filter limits</Button>}
resourceTypes={[UsageResourceType.AI]}
spenderTypes={['workspace', 'userWorkspace']}
selectedResourceType={resource}
diff --git a/packages/twenty-front/src/modules/settings/components/SettingsSearchFilterTrigger.tsx b/packages/twenty-front/src/modules/settings/components/SettingsSearchFilterTrigger.tsx
new file mode 100644
index 00000000000..12c0a46548d
--- /dev/null
+++ b/packages/twenty-front/src/modules/settings/components/SettingsSearchFilterTrigger.tsx
@@ -0,0 +1,24 @@
+import { useLingui } from '@lingui/react/macro';
+import { IconButton } from 'twenty-ui/components/input';
+import { Dropdown } from 'twenty-ui/components/navigation';
+import { IconFilter } from 'twenty-ui/icon';
+
+type SettingsSearchFilterTriggerProps = {
+ ariaLabel?: string;
+};
+
+export const SettingsSearchFilterTrigger = ({
+ ariaLabel,
+}: SettingsSearchFilterTriggerProps) => {
+ const { t } = useLingui();
+
+ return (
+ <Dropdown.Trigger
+ render={
+ <IconButton aria-label={ariaLabel ?? t`Filter`}>
+ <IconFilter />
+ </IconButton>
+ }
+ />
+ );
+};
diff --git a/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectFieldTable.tsx b/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectFieldTable.tsx
index b01c58d736b..f687b313fba 100644
--- a/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectFieldTable.tsx
+++ b/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectFieldTable.tsx
@@ -33,6 +33,7 @@ import { themeCssVariables } from 'twenty-ui/theme';
import { useMapFieldMetadataItemToSettingsObjectDetailTableItem } from '@/settings/data-model/object-details/hooks/useMapFieldMetadataItemToSettingsObjectDetailTableItem';
import { type SettingsObjectDetailTableItem } from '@/settings/data-model/types/SettingsObjectDetailTableItem';
import { normalizeSearchText } from 'twenty-ui/utilities';
+import { SettingsSearchFilterTrigger } from '@/settings/components/SettingsSearchFilterTrigger';
const StyledSearchContainer = styled.div`
padding-bottom: ${themeCssVariables.spacing[2]};
@@ -174,12 +175,12 @@ export const SettingsObjectFieldTable = ({
placeholder={t`Search a field...`}
value={searchTerm}
onValueChange={setSearchTerm}
- filterDropdown={(filterButton) => (
+ actions={
<DropdownRoot
dropdownId="settings-fields-filter-dropdown"
type="panel"
>
- <Dropdown.Trigger render={filterButton} />
+ <SettingsSearchFilterTrigger />
<DropdownContent
side="bottom"
align="end"
@@ -214,7 +215,7 @@ export const SettingsObjectFieldTable = ({
</Dropdown.Section>
</DropdownContent>
</DropdownRoot>
- )}
+ }
/>
</StyledSearchContainer>
<Table>
diff --git a/packages/twenty-front/src/modules/settings/data-model/object-details/components/tabs/SettingsObjectIndexesSection.tsx b/packages/twenty-front/src/modules/settings/data-model/object-details/components/tabs/SettingsObjectIndexesSection.tsx
index 4828779f7c4..005f815daf2 100644
--- a/packages/twenty-front/src/modules/settings/data-model/object-details/components/tabs/SettingsObjectIndexesSection.tsx
+++ b/packages/twenty-front/src/modules/settings/data-model/object-details/components/tabs/SettingsObjectIndexesSection.tsx
@@ -26,6 +26,7 @@ import { themeCssVariables } from 'twenty-ui/theme';
import { SettingsObjectIndexTable } from '@/settings/data-model/object-details/components/SettingsObjectIndexTable';
import { type SettingsObjectIndexesTableItem } from '@/settings/data-model/types/SettingsObjectIndexesTableItem';
import { normalizeSearchText } from 'twenty-ui/utilities';
+import { SettingsSearchFilterTrigger } from '@/settings/components/SettingsSearchFilterTrigger';
type SettingsObjectIndexesSectionProps = {
objectMetadataItem: EnrichedObjectMetadataItem;
@@ -166,12 +167,12 @@ export const SettingsObjectIndexesSection = ({
placeholder={t`Search an index...`}
value={searchTerm}
onValueChange={setSearchTerm}
- filterDropdown={(filterButton) => (
+ actions={
<DropdownRoot
dropdownId={HIDE_SYSTEM_INDEXES_DROPDOWN_ID}
type="panel"
>
- <Dropdown.Trigger render={filterButton} />
+ <SettingsSearchFilterTrigger />
<DropdownContent align="end" sideOffset={8}>
<Dropdown.Section>
<SettingsRow
@@ -184,7 +185,7 @@ export const SettingsObjectIndexesSection = ({
</Dropdown.Section>
</DropdownContent>
</DropdownRoot>
- )}
+ }
/>
<SettingsObjectIndexTable
items={filteredItems}
diff --git a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentSkillsTab.tsx b/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentSkillsTab.tsx
index f12431fd56b..9cb13d3f6b5 100644
--- a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentSkillsTab.tsx
+++ b/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentSkillsTab.tsx
@@ -26,6 +26,7 @@ import { SETTINGS_SKILL_TABLE_METADATA } from '~/pages/settings/ai/constants/Set
import { type SettingsSkillTableItem } from '~/pages/settings/ai/types/SettingsSkillTableItem';
import { SettingsAgentSkillsTable } from './SettingsAgentSkillsTable';
import { normalizeSearchText } from 'twenty-ui/utilities';
+import { SettingsSearchFilterTrigger } from '@/settings/components/SettingsSearchFilterTrigger';
const StyledSearchContainer = styled.div`
padding-bottom: ${themeCssVariables.spacing[2]};
@@ -128,12 +129,12 @@ export const SettingsAgentSkillsTab = () => {
placeholder={t`Search a skill...`}
value={searchTerm}
onValueChange={setSearchTerm}
- filterDropdown={(filterButton) => (
+ actions={
<DropdownRoot
dropdownId="settings-skills-filter-dropdown"
type="panel"
>
- <Dropdown.Trigger render={filterButton} />
+ <SettingsSearchFilterTrigger />
<DropdownContent
side="bottom"
align="end"
@@ -156,7 +157,7 @@ export const SettingsAgentSkillsTab = () => {
</Dropdown.Section>
</DropdownContent>
</DropdownRoot>
- )}
+ }
/>
</StyledSearchContainer>
<SettingsAgentSkillsTable
diff --git a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentToolsTab.tsx b/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentToolsTab.tsx
index a124a2d72b6..fde4e7105d8 100644
--- a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentToolsTab.tsx
+++ b/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentToolsTab.tsx
@@ -15,6 +15,7 @@ import { useSettingsAgentToolsTable } from '~/pages/settings/ai/hooks/useSetting
import { type SettingsAgentToolItem } from '~/pages/settings/ai/types/SettingsAgentToolItem';
import { isOwnedByInstalledApplication } from '@/applications/utils/isOwnedByInstalledApplication';
import { normalizeSearchText } from 'twenty-ui/utilities';
+import { SettingsSearchFilterTrigger } from '@/settings/components/SettingsSearchFilterTrigger';
const StyledSearchContainer = styled.div`
padding-bottom: ${themeCssVariables.spacing[2]};
@@ -84,12 +85,12 @@ export const SettingsAgentToolsTab = () => {
placeholder={t`Search a tool...`}
value={searchTerm}
onValueChange={setSearchTerm}
- filterDropdown={(filterButton) => (
+ actions={
<DropdownRoot
dropdownId="settings-tools-filter-dropdown"
type="panel"
>
- <Dropdown.Trigger render={filterButton} />
+ <SettingsSearchFilterTrigger />
<DropdownContent
side="bottom"
align="end"
@@ -115,7 +116,7 @@ export const SettingsAgentToolsTab = () => {
</Dropdown.Section>
</DropdownContent>
</DropdownRoot>
- )}
+ }
/>
</StyledSearchContainer>
<SettingsAgentToolsTable
diff --git a/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationsAvailableTab.tsx b/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationsAvailableTab.tsx
index 47fb5000f8d..bbcab646698 100644
--- a/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationsAvailableTab.tsx
+++ b/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationsAvailableTab.tsx
@@ -18,6 +18,7 @@ import { themeCssVariables } from 'twenty-ui/theme';
import { SettingsApplicationLoadErrorBanner } from '~/pages/settings/applications/components/SettingsApplicationLoadErrorBanner';
import { SettingsAvailableApplicationCard } from '~/pages/settings/applications/components/SettingsAvailableApplicationCard';
import { filterMarketplaceApps } from '~/pages/settings/applications/utils/filterMarketplaceApps';
+import { SettingsSearchFilterTrigger } from '@/settings/components/SettingsSearchFilterTrigger';
const StyledSearchInputContainer = styled.div`
padding-bottom: ${themeCssVariables.spacing[2]};
@@ -136,12 +137,11 @@ export const SettingsApplicationsAvailableTab = () => {
<StyledSearchInputContainer>
<SearchInput
placeholder={t`Search an application`}
- filterButtonAriaLabel={t`Filter applications`}
value={searchTerm}
onValueChange={setSearchTerm}
- filterDropdown={(filterButton) => (
+ actions={
<DropdownRoot dropdownId="marketplace-filter-dropdown" type="panel">
- <Dropdown.Trigger render={filterButton} />
+ <SettingsSearchFilterTrigger ariaLabel={t`Filter applications`} />
<DropdownContent
side="bottom"
align="end"
@@ -157,7 +157,7 @@ export const SettingsApplicationsAvailableTab = () => {
</Dropdown.Section>
</DropdownContent>
</DropdownRoot>
- )}
+ }
/>
</StyledSearchInputContainer>
diff --git a/packages/twenty-front/src/pages/settings/data-model/SettingsObjectTable.tsx b/packages/twenty-front/src/pages/settings/data-model/SettingsObjectTable.tsx
index c4a5088bcfb..8f136c9b3fa 100644
--- a/packages/twenty-front/src/pages/settings/data-model/SettingsObjectTable.tsx
+++ b/packages/twenty-front/src/pages/settings/data-model/SettingsObjectTable.tsx
@@ -38,6 +38,7 @@ import { useNavigateSettings } from '~/hooks/useNavigateSettings';
import { GET_SETTINGS_OBJECT_TABLE_METADATA } from '~/pages/settings/data-model/constants/SettingsObjectTableMetadata';
import type { SettingsObjectTableItem } from '~/pages/settings/data-model/types/SettingsObjectTableItem';
import { normalizeSearchText } from 'twenty-ui/utilities';
+import { SettingsSearchFilterTrigger } from '@/settings/components/SettingsSearchFilterTrigger';
const StyledIconChevronRightContainer = styled.div`
color: ${themeCssVariables.font.color.tertiary};
@@ -163,12 +164,12 @@ export const SettingsObjectTable = ({
placeholder={t`Search for an object...`}
value={searchTerm}
onValueChange={setSearchTerm}
- filterDropdown={(filterButton) => (
+ actions={
<DropdownRoot
dropdownId="settings-objects-filter-dropdown"
type="panel"
>
- <Dropdown.Trigger render={filterButton} />
+ <SettingsSearchFilterTrigger />
<DropdownContent
side="bottom"
align="end"
@@ -195,7 +196,7 @@ export const SettingsObjectTable = ({
</Dropdown.Section>
</DropdownContent>
</DropdownRoot>
- )}
+ }
/>
</StyledSearchInputContainer>
)}
diff --git a/packages/twenty-ui/docs/label-ownership.md b/packages/twenty-ui/docs/label-ownership.md
index a7b8202dea8..64ff3fcf0b9 100644
--- a/packages/twenty-ui/docs/label-ownership.md
+++ b/packages/twenty-ui/docs/label-ownership.md
@@ -12,7 +12,7 @@ This covers production exports under components, primitives, and icons, includin
| Legacy menu compositions | MenuItem exposes `text`, contextual slots, and `shortcutJoinLabel` (default `then`). Avatar, draggable, suggestion, and picker presets receive their text from callers; they add no English fallback. Keep this additive option until their separate migration removes the exports. |
| Button, MainButton, LightButton | Children and native accessible attributes. Applications compose upcoming-feature labels with Badge. Loading preserves the supplied name and marks the button busy; its spinner is decorative. Button hints use the shared Shortcut presentation and remain decorative. `shortcutJoinLabel` supplies the sequence join label. |
| IconButton and LightIconButton | Caller-supplied accessible label and optional tooltip. Native `aria-labelledby` remains available and takes precedence. |
-| SearchInput | Caller-owned placeholder and native accessible name; `filterButtonAriaLabel` defaults to `Filter`. Referenced labels take precedence over explicit labels and placeholder fallback. |
+| SearchInput | Caller-owned placeholder, native accessible name and action labels. Referenced labels take precedence over explicit labels and placeholder fallback. |
| CountrySelect | `searchLabel`, `noCountryLabel`, and `noResultsLabel` default to `Search`, `No country`, and `No results`. The search label names the search input and is its placeholder. Applications supply `label` or native accessible names and the country labels, including translated strings. |
| PhoneCountryPicker | Callers supply country labels and the trigger accessible name. The popup takes the trigger name unless a `Dropdown.Title` or an explicit `Dropdown.Content` label names it, and the selected country label describes the trigger. `searchLabel` defaults to `Search`; `emptyLabel` defaults to `No results`. Calling codes are supplied as data without a leading plus sign. |
| ImageInput | `uploadLabel`, `removeLabel`, and `abortLabel` default to `Upload`, `Remove`, and `Abort`. The upload label names the visible upload button, preview button, and hidden file input. Native accessible attributes can supply names and descriptions for the file input. Applications supply `helperText` and `errorMessage`, including validation instructions and translated strings. |
diff --git a/packages/twenty-ui/docs/searchInputPropDescriptions.ts b/packages/twenty-ui/docs/searchInputPropDescriptions.ts
index fb940145d9f..151a701a3af 100644
--- a/packages/twenty-ui/docs/searchInputPropDescriptions.ts
+++ b/packages/twenty-ui/docs/searchInputPropDescriptions.ts
@@ -7,16 +7,16 @@ export const SEARCH_INPUT_PROP_DESCRIPTIONS = {
onValueChange: 'Called with the new text. The application owns filtering.',
onChange: 'Native input change event handler.',
ref: 'Ref to the native input element.',
- size: 'Visual size of the input group and optional filter button.',
+ size: 'Visual size of the input group.',
placeholder:
'Hint shown when the input is empty. Also used as the accessible name if no explicit label is supplied.',
- filterDropdown: 'Renders a filter popup around the supplied filter button.',
+ actions:
+ 'Controls rendered after the search field, such as a filter Dropdown. Set their size and accessible names on the controls.',
autoFocus: 'Focuses the input when mounted.',
disabled:
- 'Disables the text input. Configure filter popup controls separately.',
+ 'Disables the text input. Controls in actions keep their own state.',
className: 'Class applied to the input.',
id: 'Input ID, generated when omitted.',
- filterButtonAriaLabel: 'Accessible label for the optional filter button.',
'aria-label': 'Accessible name when aria-labelledby is absent.',
'aria-labelledby':
'ID of the element that labels the input. Takes precedence over aria-label.',
diff --git a/packages/twenty-ui/generated/components.docs.json b/packages/twenty-ui/generated/components.docs.json
index e9c9bf31f4e..394c760ebda 100644
--- a/packages/twenty-ui/generated/components.docs.json
+++ b/packages/twenty-ui/generated/components.docs.json
@@ -13479,6 +13479,13 @@
"entryPoint": "twenty-ui/components/input",
"slug": "components/input/search-input",
"props": [
+ {
+ "name": "actions",
+ "type": "ReactNode",
+ "required": false,
+ "defaultValue": null,
+ "description": "Controls rendered after the search field, such as a filter Dropdown. Set their size and accessible names on the controls."
+ },
{
"name": "aria-label",
"type": "string",
@@ -13519,21 +13526,7 @@
"type": "boolean",
"required": false,
"defaultValue": null,
- "description": "Disables the text input. Configure filter popup controls separately."
- },
- {
- "name": "filterButtonAriaLabel",
- "type": "string",
- "required": false,
- "defaultValue": "Filter",
- "description": "Accessible label for the optional filter button."
- },
- {
- "name": "filterDropdown",
- "type": "((filterButton: ReactElement<unknown, string | JSXElementConstructor<any>>) => ReactNode)",
- "required": false,
- "defaultValue": null,
- "description": "Renders a filter popup around the supplied filter button."
+ "description": "Disables the text input. Controls in actions keep their own state."
},
{
"name": "id",
@@ -13582,7 +13575,7 @@
"type": "\"md\" | \"sm\"",
"required": false,
"defaultValue": "md",
- "description": "Visual size of the input group and optional filter button."
+ "description": "Visual size of the input group."
},
{
"name": "style",
diff --git a/packages/twenty-ui/src/components/__stories__/LabelOverrides.stories.tsx b/packages/twenty-ui/src/components/__stories__/LabelOverrides.stories.tsx
index 6e67a625319..1c24503da08 100644
--- a/packages/twenty-ui/src/components/__stories__/LabelOverrides.stories.tsx
+++ b/packages/twenty-ui/src/components/__stories__/LabelOverrides.stories.tsx
@@ -89,8 +89,6 @@ export const NativeNames: Story = {
placeholder="Search everything"
aria-label="Fallback search"
aria-labelledby="search-label"
- filterDropdown={(button) => button}
- filterButtonAriaLabel="Filter contacts"
/>
<Text id="avatar-label">Open profile</Text>
<Avatar
@@ -119,9 +117,6 @@ export const NativeNames: Story = {
expect(
canvas.getByRole('textbox', { name: 'Find contacts' }),
).toHaveAttribute('placeholder', 'Search everything');
- expect(
- canvas.getByRole('button', { name: 'Filter contacts' }),
- ).toBeVisible();
expect(canvas.getByRole('button', { name: 'Open profile' })).toBeVisible();
expect(
canvas.getByRole('separator', { name: 'Resize details' }),
diff --git a/packages/twenty-ui/src/components/input/SearchInput/SearchInput.module.scss b/packages/twenty-ui/src/components/input/SearchInput/SearchInput.module.scss
index caf291f279a..b5e3a513b16 100644
--- a/packages/twenty-ui/src/components/input/SearchInput/SearchInput.module.scss
+++ b/packages/twenty-ui/src/components/input/SearchInput/SearchInput.module.scss
@@ -5,10 +5,6 @@
width: 100%;
}
-.filterButton {
- @include square-button;
-}
-
.inputGroup {
box-sizing: border-box;
flex: 1;
diff --git a/packages/twenty-ui/src/components/input/SearchInput/SearchInput.module.scss.d.ts b/packages/twenty-ui/src/components/input/SearchInput/SearchInput.module.scss.d.ts
index 7dabe4c96e1..adef03f3e69 100644
--- a/packages/twenty-ui/src/components/input/SearchInput/SearchInput.module.scss.d.ts
+++ b/packages/twenty-ui/src/components/input/SearchInput/SearchInput.module.scss.d.ts
@@ -1,6 +1,5 @@
declare const classNames: {
readonly wrapper: 'wrapper';
- readonly filterButton: 'filterButton';
readonly inputGroup: 'inputGroup';
readonly searchIcon: 'searchIcon';
};
diff --git a/packages/twenty-ui/src/components/input/SearchInput/SearchInput.tsx b/packages/twenty-ui/src/components/input/SearchInput/SearchInput.tsx
index 66a4f5be96b..de7cf14561f 100644
--- a/packages/twenty-ui/src/components/input/SearchInput/SearchInput.tsx
+++ b/packages/twenty-ui/src/components/input/SearchInput/SearchInput.tsx
@@ -2,8 +2,7 @@ import { isNonEmptyString } from '@sniptt/guards';
import { useId } from 'react';
import { type SearchInputProps } from './types/SearchInputProps';
-import { IconFilter, IconSearch } from '@ui/icon';
-import { Button } from '@ui/primitives/input/Button/Button';
+import { IconSearch } from '@ui/icon';
import { Input } from '@ui/primitives/input/Input/Input';
import { InputGroup } from '@ui/primitives/input/InputGroup/InputGroup';
import { useTheme } from '@ui/theme';
@@ -12,10 +11,9 @@ import styles from './SearchInput.module.scss';
export const SearchInput = ({
placeholder,
- filterDropdown,
+ actions,
size = 'md',
id,
- filterButtonAriaLabel = 'Filter',
'aria-label': ariaLabel,
'aria-labelledby': ariaLabelledby,
...props
@@ -24,16 +22,6 @@ export const SearchInput = ({
const generatedId = useId();
const inputId = id ?? generatedId;
- const filterButton = (
- <Button
- variant="outline"
- size={size}
- aria-label={filterButtonAriaLabel}
- startIcon={<IconFilter size={theme.icon.size.md} />}
- className={styles.filterButton}
- />
- );
-
return (
<div className={styles.wrapper}>
<InputGroup
@@ -59,7 +47,7 @@ export const SearchInput = ({
aria-labelledby={ariaLabelledby}
/>
</InputGroup>
- {filterDropdown?.(filterButton)}
+ {actions}
</div>
);
};
diff --git a/packages/twenty-ui/src/components/input/SearchInput/__stories__/SearchInput.interactions.stories.tsx b/packages/twenty-ui/src/components/input/SearchInput/__stories__/SearchInput.interactions.stories.tsx
index affcf026766..8c27817d567 100644
--- a/packages/twenty-ui/src/components/input/SearchInput/__stories__/SearchInput.interactions.stories.tsx
+++ b/packages/twenty-ui/src/components/input/SearchInput/__stories__/SearchInput.interactions.stories.tsx
@@ -2,7 +2,9 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
import { useRef, useState } from 'react';
import { expect, fn, userEvent, waitFor, within } from 'storybook/test';
+import { IconButton } from '@ui/components/input/IconButton/IconButton';
import { Dropdown } from '@ui/components/navigation/Dropdown/Dropdown';
+import { IconFilter } from '@ui/icon';
import { Button } from '@ui/primitives/input/Button/Button';
import { Field } from '@ui/primitives/input/Field/Field';
import { Input } from '@ui/primitives/input/Input/Input';
@@ -78,11 +80,14 @@ const FilterPanelExample = ({
value={search}
onValueChange={setSearch}
disabled={searchDisabled}
- filterButtonAriaLabel="Filter people"
- filterDropdown={(filterButton) => (
+ actions={
<Dropdown.Root type="panel" open={open} onOpenChange={setOpen}>
<Dropdown.Trigger
- render={filterButton}
+ render={
+ <IconButton aria-label="Filter people">
+ <IconFilter />
+ </IconButton>
+ }
ref={triggerRef}
onClick={onTriggerClick}
disabled={filterDisabled}
@@ -98,7 +103,7 @@ const FilterPanelExample = ({
</Dropdown.Section>
</Dropdown.Content>
</Dropdown.Root>
- )}
+ }
/>
<Button onClick={() => triggerRef.current?.focus()}>Focus filters</Button>
</form>
@@ -148,6 +153,9 @@ export const NativeInput: Story = {
);
expect(onSubmit).toHaveBeenCalledWith('Ada');
expect(onBlur).toHaveBeenCalledOnce();
+
+ await userEvent.clear(input);
+ expect(input).toHaveValue('');
},
};
diff --git a/packages/twenty-ui/src/components/input/SearchInput/__stories__/SearchInput.stories.tsx b/packages/twenty-ui/src/components/input/SearchInput/__stories__/SearchInput.stories.tsx
index 10edd4b9ec3..910662a3d8f 100644
--- a/packages/twenty-ui/src/components/input/SearchInput/__stories__/SearchInput.stories.tsx
+++ b/packages/twenty-ui/src/components/input/SearchInput/__stories__/SearchInput.stories.tsx
@@ -1,7 +1,9 @@
import { type Meta, type StoryObj } from '@storybook/react-vite';
import { ComponentDecorator } from '@ui/testing';
+import { IconButton } from '@ui/components/input/IconButton/IconButton';
import { Dropdown } from '@ui/components/navigation/Dropdown/Dropdown';
import { SettingsRow } from '@ui/components/settings/SettingsRow/SettingsRow';
+import { IconFilter } from '@ui/icon';
import { SearchInputExample } from './SearchInputExample';
@@ -38,10 +40,15 @@ export const Compact: Story = {
export const WithFilter: Story = {
args: {
placeholder: 'Search people...',
- filterButtonAriaLabel: 'Filter people',
- filterDropdown: (filterButton) => (
+ actions: (
<Dropdown.Root type="panel">
- <Dropdown.Trigger render={filterButton} />
+ <Dropdown.Trigger
+ render={
+ <IconButton aria-label="Filter people">
+ <IconFilter />
+ </IconButton>
+ }
+ />
<Dropdown.Content align="end">
<Dropdown.Section>
<SettingsRow defaultChecked>Include inactive people</SettingsRow>
diff --git a/packages/twenty-ui/src/components/input/SearchInput/types/SearchInputProps.ts b/packages/twenty-ui/src/components/input/SearchInput/types/SearchInputProps.ts
index 7efe3d8a99e..b42a6f3d2cd 100644
--- a/packages/twenty-ui/src/components/input/SearchInput/types/SearchInputProps.ts
+++ b/packages/twenty-ui/src/components/input/SearchInput/types/SearchInputProps.ts
@@ -1,8 +1,7 @@
-import { type ReactElement, type ReactNode } from 'react';
+import { type ReactNode } from 'react';
import { type InputProps } from '@ui/primitives/input/Input/types/InputProps';
export type SearchInputProps = InputProps & {
- filterDropdown?: (filterButton: ReactElement) => ReactNode;
- filterButtonAriaLabel?: string;
+ actions?: ReactNode;
};