Commit 9a4c030
authored
This PR adds the `invalid` prop to the `Combobox` component. This will
also expose the `invalid` value as a render prop to the `Combobox.Input`
and `Combobox.Button` components.
It will also expose the `data-invalid` attribute on these components
when the `invalid` prop is set to `true`.
```tsx
<Combobox invalid>
<Combobox.Input />
<Combobox.Button />
</Combobox>
```
Without `invalid` prop:
<img width="916" alt="image"
src="https://github.com/user-attachments/assets/2c199691-7b29-450f-89a5-4b84e6704c6a"
/>
With invalid prop:
<img width="913" alt="image"
src="https://github.com/user-attachments/assets/4bdde518-39b3-4998-b353-604a818a3c99"
/>
Notice the `data-invalid` prop on the `<input>` and the `<button>`.
1 parent 0a8de01 commit 9a4c030
File tree
3 files changed
+19
-4
lines changed- packages/@headlessui-react
- src/components/combobox
3 files changed
+19
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1045 | 1045 | | |
1046 | 1046 | | |
1047 | 1047 | | |
| 1048 | + | |
1048 | 1049 | | |
1049 | 1050 | | |
1050 | 1051 | | |
| |||
1061 | 1062 | | |
1062 | 1063 | | |
1063 | 1064 | | |
| 1065 | + | |
1064 | 1066 | | |
1065 | 1067 | | |
1066 | 1068 | | |
| |||
1094 | 1096 | | |
1095 | 1097 | | |
1096 | 1098 | | |
| 1099 | + | |
1097 | 1100 | | |
1098 | 1101 | | |
1099 | 1102 | | |
| |||
1110 | 1113 | | |
1111 | 1114 | | |
1112 | 1115 | | |
| 1116 | + | |
1113 | 1117 | | |
1114 | 1118 | | |
1115 | 1119 | | |
| |||
Lines changed: 13 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
577 | 577 | | |
578 | 578 | | |
579 | 579 | | |
| 580 | + | |
580 | 581 | | |
581 | 582 | | |
582 | 583 | | |
| |||
619 | 620 | | |
620 | 621 | | |
621 | 622 | | |
| 623 | + | |
622 | 624 | | |
623 | 625 | | |
624 | 626 | | |
| |||
648 | 650 | | |
649 | 651 | | |
650 | 652 | | |
| 653 | + | |
651 | 654 | | |
652 | 655 | | |
653 | 656 | | |
| |||
676 | 679 | | |
677 | 680 | | |
678 | 681 | | |
| 682 | + | |
679 | 683 | | |
680 | 684 | | |
681 | 685 | | |
| |||
751 | 755 | | |
752 | 756 | | |
753 | 757 | | |
| 758 | + | |
754 | 759 | | |
755 | 760 | | |
756 | 761 | | |
| |||
785 | 790 | | |
786 | 791 | | |
787 | 792 | | |
788 | | - | |
| 793 | + | |
789 | 794 | | |
790 | 795 | | |
791 | 796 | | |
| |||
813 | 818 | | |
814 | 819 | | |
815 | 820 | | |
| 821 | + | |
816 | 822 | | |
817 | 823 | | |
818 | 824 | | |
| |||
822 | 828 | | |
823 | 829 | | |
824 | 830 | | |
825 | | - | |
| 831 | + | |
826 | 832 | | |
827 | 833 | | |
828 | 834 | | |
| |||
999 | 1005 | | |
1000 | 1006 | | |
1001 | 1007 | | |
| 1008 | + | |
1002 | 1009 | | |
1003 | 1010 | | |
1004 | 1011 | | |
| |||
1398 | 1405 | | |
1399 | 1406 | | |
1400 | 1407 | | |
| 1408 | + | |
1401 | 1409 | | |
1402 | 1410 | | |
1403 | 1411 | | |
1404 | 1412 | | |
1405 | | - | |
| 1413 | + | |
1406 | 1414 | | |
1407 | 1415 | | |
1408 | 1416 | | |
| |||
1463 | 1471 | | |
1464 | 1472 | | |
1465 | 1473 | | |
| 1474 | + | |
1466 | 1475 | | |
1467 | 1476 | | |
1468 | 1477 | | |
| |||
1587 | 1596 | | |
1588 | 1597 | | |
1589 | 1598 | | |
| 1599 | + | |
1590 | 1600 | | |
1591 | 1601 | | |
1592 | 1602 | | |
| |||
0 commit comments