Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(combobox): add combobox properties to docs and examples #923

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions shared/src/controls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ export const switchControls = defineControls({
})

export const comboboxControls = defineControls({
disabled: { type: "boolean", defaultValue: false },
readOnly: { type: "boolean", defaultValue: false },
multiple: { type: "boolean", defaultValue: false },
allowCustomValue: { type: "boolean", defaultValue: false },
loop: { type: "boolean", defaultValue: true },
openOnClick: { type: "boolean", defaultValue: false },
closeOnSelect: { type: "boolean", defaultValue: true },
selectOnBlur: { type: "boolean", defaultValue: true },
placeholder: { type: "string", defaultValue: "Type or select a country" },
inputBehavior: {
type: "select",
defaultValue: "autohighlight",
Expand All @@ -28,11 +37,6 @@ export const comboboxControls = defineControls({
defaultValue: "replace",
options: ["replace", "clear", "preserve"] as const,
},
disabled: { type: "boolean", defaultValue: false },
multiple: { type: "boolean", defaultValue: false },
loop: { type: "boolean", defaultValue: true },
openOnClick: { type: "boolean", defaultValue: false },
selectOnBlur: { type: "boolean", defaultValue: true },
})

export const editableControls = defineControls({
Expand Down
1 change: 0 additions & 1 deletion website/components/machines/combobox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ export function Combobox(props: ComboboxProps) {
)
setOptions(filtered.length > 0 ? filtered : comboboxData)
},
placeholder: "Type or select country",
}),
{ context: { ...props.controls, collection } },
)
Expand Down
14 changes: 12 additions & 2 deletions website/components/showcase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,21 @@ const components = {
defaultProps={{
disabled: false,
readOnly: false,
loop: false,
multiple: false,
allowCustomValue: false,
loop: true,
openOnClick: false,
closeOnSelect: true,
selectOnBlur: true,
placeholder: "Type or select a country",
inputBehavior: {
default: "autohighlight",
default: "none",
options: ["autohighlight", "autocomplete", "none"],
},
selectionBehavior: {
default: "replace",
options: ["replace", "clear", "preserve"],
},
}}
/>
),
Expand Down
6 changes: 3 additions & 3 deletions website/data/components/combobox.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ const [state, send] = useMachine(

## Rendering the selected values outside the combobox

By default, the selected values of a combobox is displayed in the input element,
when selecting multiple items, it is a better UX to render the selected value
outside the combobox.
By default, the selected values of a combobox are displayed in the input
element, when selecting multiple items, it is a better UX to render the selected
value outside the combobox.

To achieve this you need to:

Expand Down
Loading