Skip to content

Commit 28b744c

Browse files
feat(ui): introduce SelectButton for a select-like appearance in ComboboxTrigger, MenuTrigger, etc
1 parent eca5fdd commit 28b744c

File tree

30 files changed

+426
-166
lines changed

30 files changed

+426
-166
lines changed

apps/examples/calcom/app/(settings)/settings/my-account/general/page.tsx

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import { Fieldset, FieldsetLegend } from "@coss/ui/components/fieldset";
2525
import { Label } from "@coss/ui/components/label";
2626
import {
2727
Select,
28+
SelectButton,
2829
SelectItem,
2930
SelectPopup,
3031
SelectTrigger,
@@ -134,17 +135,8 @@ export default function GeneralSettingsPage() {
134135
defaultValue={defaultTimezone}
135136
items={formattedTimezones}
136137
>
137-
<ComboboxTrigger
138-
className="flex-1"
139-
render={
140-
<Button
141-
className="w-full justify-between font-normal"
142-
variant="outline"
143-
/>
144-
}
145-
>
138+
<ComboboxTrigger render={<SelectButton />}>
146139
<ComboboxValue />
147-
<ChevronsUpDownIcon className="-me-1!" />
148140
</ComboboxTrigger>
149141
<ComboboxPopup aria-label="Select timezone">
150142
<div className="border-b p-2">

apps/examples/calcom/components/app/bookings-saved-filters.tsx

Lines changed: 0 additions & 78 deletions
This file was deleted.

apps/ui/content/docs/components/combobox.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,12 @@ Use the `startAddon` prop on `ComboboxChips` to display an icon at the start whe
311311

312312
<ComponentPreview name="p-combobox-10" />
313313

314+
### With Select-like Button
315+
316+
Use `SelectButton` as a `render` prop on `ComboboxTrigger` to make the combobox trigger look like a select.
317+
318+
<ComponentPreview name="p-combobox-18" />
319+
314320
### Form Integration
315321

316322
<ComponentPreview name="p-combobox-11" />

apps/ui/content/docs/components/select.mdx

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,24 @@ Label for a select group. Styled wrapper for `Select.GroupLabel` from Base UI.
123123

124124
Visual separator between items. Styled wrapper for `Select.Separator` from Base UI.
125125

126+
### SelectButton
127+
128+
A standalone button styled like a `SelectTrigger`. Use it as a `render` prop on other trigger components (e.g., `ComboboxTrigger`, `MenuTrigger`) to give them select-like appearance.
129+
130+
| Prop | Type | Default | Description |
131+
| ------ | --------------------------- | ----------- | ------------------------------------------------ |
132+
| `size` | `"sm" \| "default" \| "lg"` | `"default"` | Controls the size of the button |
133+
134+
```tsx
135+
import { SelectButton } from "@/components/ui/select"
136+
```
137+
138+
```tsx
139+
<ComboboxTrigger render={<SelectButton />}>
140+
<ComboboxValue placeholder="Select a fruit" />
141+
</ComboboxTrigger>
142+
```
143+
126144
## Examples
127145

128146
For accessible labelling and validation, prefer using the `Field` component to wrap selects. See the related example: [Select field](/ui/docs/components/field#select-field).
@@ -163,6 +181,13 @@ For accessible labelling and validation, prefer using the `Field` component to w
163181

164182
<ComponentPreview name="p-select-10" />
165183

184+
### SelectButton with Combobox
185+
186+
Use `SelectButton` as a `render` prop on `ComboboxTrigger` to create a combobox that looks like a select.
187+
188+
<ComponentPreview name="p-combobox-18" />
189+
166190
### Form Integration
167191

168192
<ComponentPreview name="p-select-11" />
193+

apps/ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"dependencies": {
3-
"@base-ui/react": "^1.0.0",
3+
"@base-ui/react": "^1.1.0",
44
"@coss/ui": "workspace:*",
55
"@hugeicons/core-free-icons": "^2.0.0",
66
"@hugeicons/react": "^1.1.1",

apps/ui/public/r/autocomplete.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)