fix(select): add missing data-invalid in select and add missing data attributes in docs (#3177)

* fix(select): add missing data-invalid attribute

* chore(docs): add missing data attributes for select base
This commit is contained in:
աӄա 2024-06-07 08:35:59 +08:00 committed by GitHub
parent 6df27c6e63
commit a0d6a77efb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 14 additions and 0 deletions

View File

@ -0,0 +1,5 @@
---
"@nextui-org/select": patch
---
Add missing `data-invalid` attribute (#3149)

View File

@ -285,6 +285,14 @@ the popover and listbox components.
- **data-filled**:
Indicates if the select has a value, is focused, has start/end content or is open.
- **data-has-value**:
Indicates if the select has selected item(s).
- **data-has-label**:
Indicates if the select has a label. Based on `label` prop.
- **data-has-helper**:
Indicates if the select has helper text. Based on `errorMessage` or `description` prop.
- **data-invalid**:
Indicates if the select is invalid. Based on `isInvalid` prop.
`Select` has the following attributes on the `trigger` element:

View File

@ -377,6 +377,7 @@ export function useSelect<T extends object>(originalProps: UseSelectProps<T>) {
"data-has-value": dataAttr(hasValue),
"data-has-label": dataAttr(hasLabel),
"data-has-helper": dataAttr(hasHelper),
"data-invalid": dataAttr(isInvalid),
className: slots.base({
class: clsx(baseStyles, props.className),
}),