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(Autocomplete): add RAC Autocomplete docs #7784

Merged
merged 22 commits into from
Feb 22, 2025
Merged

Conversation

reidbarber
Copy link
Member

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component).
  • Looked at the Accessibility Practices for this feature - Aria Practices

📝 Test Instructions:

🧢 Your Project:

@rspbot
Copy link

rspbot commented Feb 19, 2025

@rspbot
Copy link

rspbot commented Feb 19, 2025

Copy link
Member

@devongovett devongovett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

somehow we need to find a way to emphasize that Autocomplete works with both TextField and SearchField, and with both Menu and ListBox. Right now the examples suggest it works only with SearchField and Menu. Maybe we should mix them up a bit and provide some more varied examples that people might google for as well? Searchable menu, Command palette, Filterable Select (like the story we have), etc.

@reidbarber reidbarber changed the title [WIP] docs(Autocomplete): add RAC Autocomplete docs docs(Autocomplete): add RAC Autocomplete docs Feb 19, 2025
Copy link
Member

@yihuiliao yihuiliao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

* A autocomplete combines a text input with a menu, allowing users to filter a list of options to items matching a query.

unrelated to the changes here but i noticed that the description says "a autocomplete..." instead of "an autocomplete"

@rspbot
Copy link

rspbot commented Feb 20, 2025


return (
<div className="bg-linear-to-r from-indigo-500 to-violet-500 p-8 h-[340px] rounded-lg flex flex-col items-center justify-center">
<div className="flex flex-col gap-1 w-[320px] rounded-md bg-white shadow-lg">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to make this into a Dialog that you could open with Command K (or by clicking a button)?

snowystinger
snowystinger previously approved these changes Feb 21, 2025
@rspbot
Copy link

rspbot commented Feb 21, 2025

@rspbot
Copy link

rspbot commented Feb 21, 2025

@rspbot
Copy link

rspbot commented Feb 21, 2025

@rspbot
Copy link

rspbot commented Feb 21, 2025

yihuiliao
yihuiliao previously approved these changes Feb 21, 2025
@rspbot
Copy link

rspbot commented Feb 21, 2025

@rspbot
Copy link

rspbot commented Feb 21, 2025

## API Changes

react-aria-components

/react-aria-components:UNSTABLE_Autocomplete

-UNSTABLE_Autocomplete {
-  children: ReactNode
-  defaultInputValue?: string
-  filter?: (string, string) => boolean
-  inputValue?: string
-  onInputChange?: (string) => void
-  slot?: string | null
-}

/react-aria-components:UNSTABLE_AutocompleteContext

-UNSTABLE_AutocompleteContext {
-  UNTYPED
-}

/react-aria-components:UNSTABLE_AutocompleteStateContext

-UNSTABLE_AutocompleteStateContext {
-  UNTYPED
-}

/react-aria-components:Autocomplete

+Autocomplete {
+  children: ReactNode
+  defaultInputValue?: string
+  filter?: (string, string) => boolean
+  inputValue?: string
+  onInputChange?: (string) => void
+  slot?: string | null
+}

/react-aria-components:AutocompleteContext

+AutocompleteContext {
+  UNTYPED
+}

/react-aria-components:AutocompleteStateContext

+AutocompleteStateContext {
+  UNTYPED
+}

Copy link
Member

@devongovett devongovett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gonna merge this so we can get the code changes in for testing. I will send another PR to add a Searchable Select component.


This example shows an `AutocompleteClearButton` component that can be placed within an `Autocomplete` to allow the user to clear the input.

```tsx example
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example is still a little weird because the search field already has a clear button too. 🤔

@devongovett devongovett merged commit 7df1a84 into main Feb 22, 2025
30 checks passed
@devongovett devongovett deleted the rac-autocomplete-docs branch February 22, 2025 01:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants