@usevyre/ai-context 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  # useVyre Copilot Instructions
2
- # Version: 1.6.0
2
+ # Version: 1.16.0
3
3
 
4
4
  When generating UI code in this project, follow the useVyre design system rules below.
5
5
 
@@ -1536,6 +1536,565 @@ import { Box } from "@usevyre/react"
1536
1536
 
1537
1537
  ---
1538
1538
 
1539
+ ### Form
1540
+
1541
+ Controlled, data-driven form. Zero dependencies. Validation runs on submit and (after the first submit) on blur. Errors map into the wrapped Field automatically (state=error + hint=message). Compose with FormField, which wires name/value/onChange/onBlur into a single control child.
1542
+
1543
+ ```tsx
1544
+ import { Form, FormField } from "@usevyre/react"
1545
+
1546
+ // Props:
1547
+ // values = Record<string, any>
1548
+ // defaultValues = Record<string, any>
1549
+ // onChange = function
1550
+ // onSubmit = function
1551
+ // onInvalid = function
1552
+
1553
+ // Examples:
1554
+ const [values, setValues] = useState({ email: "", password: "" });
1555
+
1556
+ <Form values={values} onChange={setValues} onSubmit={(v) => signIn(v)}>
1557
+ <FormField name="email" label="Email" rules={{ required: true, email: true }}>
1558
+ <Input type="email" />
1559
+ </FormField>
1560
+ <FormField name="password" label="Password" rules={{ required: true, minLength: 8 }}>
1561
+ <Input type="password" />
1562
+ </FormField>
1563
+ <Button type="submit" variant="primary">Sign in</Button>
1564
+ </Form>
1565
+ <FormField
1566
+ name="confirm"
1567
+ label="Confirm password"
1568
+ rules={{
1569
+ required: true,
1570
+ validate: (v, all) => v === all.password ? null : "Passwords do not match",
1571
+ }}
1572
+ >
1573
+ <Input type="password" />
1574
+ </FormField>
1575
+ ```
1576
+
1577
+ **Common mistakes:**
1578
+ - ❌ `Manually tracking each field's error state with useState` → Wrap controls in <FormField name rules> and let Form manage errors
1579
+ - ❌ `Adding a validation library (zod/yup) just for basic rules` → Use rules={{ required, minLength, pattern, email, validate }}
1580
+ - ❌ `<FormField> with multiple control children` → Use one control per FormField (Input/Textarea/Select/etc.)
1581
+ - ❌ `<FormField> outside a <Form>` → Always nest FormField inside <Form>
1582
+
1583
+ ---
1584
+
1585
+ ### FormField
1586
+
1587
+ A single labelled, validated field inside <Form>. Injects name/value/onChange/onBlur into its one control child and wraps it in <Field> (label + error state + hint).
1588
+
1589
+ ```tsx
1590
+ import { FormField } from "@usevyre/react"
1591
+
1592
+ // Props:
1593
+ // name = string
1594
+ // label = string
1595
+ // hint = string
1596
+ // rules = object
1597
+
1598
+ // Examples:
1599
+ <FormField name="bio" label="Bio" hint="Max 200 characters" rules={{ maxLength: 200 }}>
1600
+ <Textarea />
1601
+ </FormField>
1602
+ ```
1603
+
1604
+ **Common mistakes:**
1605
+ - ❌ `Putting onChange/value manually on the control inside FormField` → Let FormField wire the control; only pass static props (type, placeholder)
1606
+
1607
+ ---
1608
+
1609
+ ### NumberInput
1610
+
1611
+ Controlled numeric input with −/+ stepper buttons. onChange emits a NUMBER (or null when empty) — NOT an event. Drops straight into <FormField> (Form handles the non-event value). Clamps to min/max on blur; keyboard ArrowUp/Down ±step, Shift+Arrow ±step×10.
1612
+
1613
+ ```tsx
1614
+ import { NumberInput } from "@usevyre/react"
1615
+
1616
+ // Props:
1617
+ // value = number | null
1618
+ // defaultValue = number | null (default: null)
1619
+ // onChange = function
1620
+ // min = number
1621
+ // max = number
1622
+ // step = number (default: 1)
1623
+ // precision = number
1624
+ // size = "sm" | "md" | "lg" (default: md)
1625
+ // disabled = boolean (default: false)
1626
+ // readOnly = boolean (default: false)
1627
+
1628
+ // Examples:
1629
+ const [qty, setQty] = useState<number | null>(1);
1630
+
1631
+ <NumberInput value={qty} onChange={setQty} min={1} max={99} />
1632
+ <FormField name="age" label="Age" rules={{ required: true, min: 18 }}>
1633
+ <NumberInput min={0} max={120} />
1634
+ </FormField>
1635
+ ```
1636
+
1637
+ **Common mistakes:**
1638
+ - ❌ `onChange={(e) => set(e.target.value)}` → onChange={(value) => set(value)} — value is number | null
1639
+ - ❌ `Using <Input type="number"> for numeric fields` → Use <NumberInput value onChange min max step />
1640
+ - ❌ `Parsing the value with Number() in form state` → Store the value directly; it is already number | null
1641
+
1642
+ ---
1643
+
1644
+ ### ToggleGroup
1645
+
1646
+ Segmented control. CONTROLLED — the group owns the value. onChange emits the VALUE (not an event). type=single → value:string|null; type=multiple → value:string[]. Provide options[] for simple lists or <ToggleItem value> children for custom content. Distinct from Switch (boolean), ButtonGroup (layout only), RadioGroup (form radios, single only).
1647
+
1648
+ ```tsx
1649
+ import { ToggleGroup, ToggleItem } from "@usevyre/react"
1650
+
1651
+ // Props:
1652
+ // type = "single" | "multiple" (default: single)
1653
+ // value = string | null | string[]
1654
+ // onChange = function
1655
+ // options = array
1656
+ // size = "sm" | "md" | "lg" (default: md)
1657
+ // orientation = "horizontal" | "vertical" (default: horizontal)
1658
+ // disabled = boolean (default: false)
1659
+
1660
+ // Examples:
1661
+ const [view, setView] = useState<string | null>("grid");
1662
+
1663
+ <ToggleGroup
1664
+ value={view}
1665
+ onChange={setView}
1666
+ options={[
1667
+ { value: "grid", label: "Grid" },
1668
+ { value: "list", label: "List" },
1669
+ ]}
1670
+ />
1671
+ const [fmt, setFmt] = useState<string[]>(["bold"]);
1672
+
1673
+ <ToggleGroup type="multiple" value={fmt} onChange={setFmt}>
1674
+ <ToggleItem value="bold">B</ToggleItem>
1675
+ <ToggleItem value="italic">I</ToggleItem>
1676
+ <ToggleItem value="underline">U</ToggleItem>
1677
+ </ToggleGroup>
1678
+ ```
1679
+
1680
+ **Common mistakes:**
1681
+ - ❌ `onChange={(e) => set(e.target.value)}` → onChange={(value) => set(value)} — string|null (single) or string[] (multiple)
1682
+ - ❌ `Using ToggleGroup for a single on/off setting` → Use <Switch> for on/off; ToggleGroup is for choosing among options
1683
+ - ❌ `type="multiple" with a string value` → value={['a','b']} and onChange receives string[]
1684
+ - ❌ `<ToggleItem> outside <ToggleGroup>` → Always nest ToggleItem inside ToggleGroup (or use options)
1685
+
1686
+ ---
1687
+
1688
+ ### ToggleItem
1689
+
1690
+ A single toggle button inside <ToggleGroup>. Reads selection state from the group via context.
1691
+
1692
+ ```tsx
1693
+ import { ToggleItem } from "@usevyre/react"
1694
+
1695
+ // Props:
1696
+ // value = string
1697
+ // icon = ReactNode
1698
+ // disabled = boolean (default: false)
1699
+
1700
+ // Examples:
1701
+ <ToggleGroup value={v} onChange={setV}>
1702
+ <ToggleItem value="left">Left</ToggleItem>
1703
+ <ToggleItem value="center">Center</ToggleItem>
1704
+ </ToggleGroup>
1705
+ ```
1706
+
1707
+ **Common mistakes:**
1708
+ - ❌ `Tracking selected state on ToggleItem yourself` → Only set value; the group controls selected state
1709
+
1710
+ ---
1711
+
1712
+ ### Stepper
1713
+
1714
+ Multi-step flow indicator + controller (onboarding/checkout/wizard). CONTROLLED by a 0-based index. Compose StepperNav (with Step indicators) and StepPanel (content shown when its index == active). Step/StepPanel take an explicit 0-based `index`. Not Tabs — Stepper is an ORDERED linear flow with completed/current/upcoming states.
1715
+
1716
+ ```tsx
1717
+ import { Stepper, StepperNav, Step, StepPanel } from "@usevyre/react"
1718
+
1719
+ // Props:
1720
+ // value = number
1721
+ // defaultValue = number (default: 0)
1722
+ // onChange = function
1723
+ // orientation = "horizontal" | "vertical" (default: horizontal)
1724
+ // clickable = boolean (default: false)
1725
+
1726
+ // Examples:
1727
+ const [step, setStep] = useState(0);
1728
+
1729
+ <Stepper value={step} onChange={setStep}>
1730
+ <StepperNav>
1731
+ <Step index={0} label="Account" />
1732
+ <Step index={1} label="Profile" />
1733
+ <Step index={2} label="Done" />
1734
+ </StepperNav>
1735
+ <StepPanel index={0}><AccountForm /></StepPanel>
1736
+ <StepPanel index={1}><ProfileForm /></StepPanel>
1737
+ <StepPanel index={2}><Summary /></StepPanel>
1738
+ <Stack direction="row" gap="sm" justify="between">
1739
+ <Button onClick={() => setStep((s) => s - 1)} disabled={step === 0}>Back</Button>
1740
+ <Button variant="primary" onClick={() => setStep((s) => s + 1)}>Next</Button>
1741
+ </Stack>
1742
+ </Stepper>
1743
+ <Stepper orientation="vertical" defaultValue={1}>
1744
+ <StepperNav>
1745
+ <Step index={0} label="Cart" description="2 items" />
1746
+ <Step index={1} label="Shipping" description="Enter address" />
1747
+ <Step index={2} label="Payment" />
1748
+ </StepperNav>
1749
+ </Stepper>
1750
+ ```
1751
+
1752
+ **Common mistakes:**
1753
+ - ❌ `Using Tabs for a wizard / checkout flow` → Use <Stepper> with StepperNav + Step + StepPanel
1754
+ - ❌ `onChange={(e) => set(e.target.value)}` → onChange={(index) => setStep(index)}
1755
+ - ❌ `Manually toggling which panel is visible` → Give each StepPanel an index; Stepper shows the active one
1756
+ - ❌ `<Step> or <StepPanel> outside <Stepper>` → Nest Step inside StepperNav, StepPanel inside Stepper
1757
+
1758
+ ---
1759
+
1760
+ ### StepperNav
1761
+
1762
+ Container for Step indicators inside <Stepper>. Lays them out per the Stepper's orientation.
1763
+
1764
+ ```tsx
1765
+ import { Stepper, StepperNav, Step, StepPanel } from "@usevyre/react"
1766
+
1767
+ ```
1768
+
1769
+ ---
1770
+
1771
+ ### Step
1772
+
1773
+ One step indicator inside <StepperNav>. State (completed/current/upcoming) derives from the Stepper's active index automatically.
1774
+
1775
+ ```tsx
1776
+ import { Stepper, StepperNav, Step, StepPanel } from "@usevyre/react"
1777
+
1778
+ // Props:
1779
+ // index = number
1780
+ // label = ReactNode
1781
+ // description = ReactNode
1782
+ // icon = ReactNode
1783
+
1784
+ ```
1785
+
1786
+ ---
1787
+
1788
+ ### StepPanel
1789
+
1790
+ Content for one step. Renders its children only when its index equals the Stepper's active step.
1791
+
1792
+ ```tsx
1793
+ import { Stepper, StepperNav, Step, StepPanel } from "@usevyre/react"
1794
+
1795
+ // Props:
1796
+ // index = number
1797
+
1798
+ ```
1799
+
1800
+ ---
1801
+
1802
+ ### EmptyState
1803
+
1804
+ Presentational placeholder for empty lists, tables, and search results. No state. title/description/variant/size are props; the optional call-to-action goes in children (React) or the default slot (Vue). variant picks a preset icon (default=box, search=magnifier, error=warning); pass `icon` (or #icon slot) to override.
1805
+
1806
+ ```tsx
1807
+ import { EmptyState } from "@usevyre/react"
1808
+
1809
+ // Props:
1810
+ // title = string
1811
+ // description = string
1812
+ // variant = "default" | "search" | "error" (default: default)
1813
+ // icon = ReactNode
1814
+ // size = "sm" | "md" | "lg" (default: md)
1815
+ // children = ReactNode
1816
+
1817
+ // Examples:
1818
+ <EmptyState
1819
+ variant="search"
1820
+ title="No results"
1821
+ description="Try a different search term."
1822
+ >
1823
+ <Button variant="secondary" onClick={reset}>Clear filters</Button>
1824
+ </EmptyState>
1825
+ <EmptyState
1826
+ size="lg"
1827
+ title="No projects yet"
1828
+ description="Create your first project to get started."
1829
+ >
1830
+ <Button variant="primary">New project</Button>
1831
+ </EmptyState>
1832
+ ```
1833
+
1834
+ **Common mistakes:**
1835
+ - ❌ `Building an empty placeholder with a bare <div> + centered text` → Use <EmptyState title description variant>
1836
+ - ❌ `action / cta prop` → Put the Button as children of EmptyState
1837
+ - ❌ `Using EmptyState for a loading state` → Use <Skeleton> while loading; EmptyState when the result set is empty
1838
+
1839
+ ---
1840
+
1841
+ ### Stat
1842
+
1843
+ Presentational dashboard KPI. No state. The arrow DIRECTION follows the sign of `delta` (the actual change: -0.4% → down arrow). The arrow/delta COLOR is set explicitly by `trend` (up=success, down=danger, neutral=muted) — so 'churn -0.4%, trend=up' shows a green DOWN arrow. Wrap several in StatGroup for an evenly-split row with dividers.
1844
+
1845
+ ```tsx
1846
+ import { Stat, StatGroup } from "@usevyre/react"
1847
+
1848
+ // Props:
1849
+ // label = string
1850
+ // value = string | number
1851
+ // delta = string | number
1852
+ // trend = "up" | "down" | "neutral" (default: neutral)
1853
+ // deltaLabel = string
1854
+ // icon = ReactNode
1855
+ // size = "sm" | "md" | "lg" (default: md)
1856
+
1857
+ // Examples:
1858
+ <StatGroup>
1859
+ <Stat label="Revenue" value="$48.2k" delta="+12%" trend="up" deltaLabel="vs last month" />
1860
+ <Stat label="Churn" value="2.1%" delta="-0.4%" trend="up" deltaLabel="lower is better" />
1861
+ <Stat label="Orders" value="1,204" delta="0%" trend="neutral" />
1862
+ </StatGroup>
1863
+ <Stat label="Active users" value="12,840" delta="+3.2%" trend="up"
1864
+ icon={<UsersIcon />} size="lg" />
1865
+ ```
1866
+
1867
+ **Common mistakes:**
1868
+ - ❌ `Assuming trend flips the arrow direction` → delta="-0.4%" always shows a down arrow; trend="up" just colors it green
1869
+ - ❌ `Building a KPI card with Card + manual layout` → Use <Stat label value delta trend />
1870
+ - ❌ `Laying out a KPI row with custom flex + dividers` → Wrap the Stats in <StatGroup>
1871
+
1872
+ ---
1873
+
1874
+ ### StatGroup
1875
+
1876
+ Evenly-split row of <Stat> with subtle dividers between items. Each Stat flexes to equal width.
1877
+
1878
+ ```tsx
1879
+ import { Stat, StatGroup } from "@usevyre/react"
1880
+
1881
+ // Examples:
1882
+ <StatGroup>
1883
+ <Stat label="MRR" value="$9.6k" delta="+5%" trend="up" />
1884
+ <Stat label="Refunds" value="32" delta="+8" trend="down" />
1885
+ </StatGroup>
1886
+ ```
1887
+
1888
+ **Common mistakes:**
1889
+ - ❌ `Putting non-Stat children in StatGroup` → Only place <Stat> elements inside StatGroup
1890
+
1891
+ ---
1892
+
1893
+ ### Timeline
1894
+
1895
+ Vertical activity feed for audit logs and history. Presentational — a status dot per item plus a connector line. Pass `items` for plain logs, or TimelineItem children for rich per-item content. Timeline does NOT reorder; pass items in the order you want shown.
1896
+
1897
+ ```tsx
1898
+ import { Timeline, TimelineItem } from "@usevyre/react"
1899
+
1900
+ // Props:
1901
+ // items = array
1902
+ // children = ReactNode
1903
+
1904
+ // Examples:
1905
+ <Timeline
1906
+ items={[
1907
+ { title: "Deployed v2.1", time: "2m ago", status: "success" },
1908
+ { title: "Build started", time: "5m ago", status: "info" },
1909
+ { title: "Push to main", time: "6m ago" },
1910
+ ]}
1911
+ />
1912
+ <Timeline>
1913
+ <TimelineItem title="Invoice paid" time="Apr 2" status="success">
1914
+ <Text size="sm">$1,200 — <a href="#">view receipt</a></Text>
1915
+ </TimelineItem>
1916
+ <TimelineItem title="Invoice sent" time="Mar 28" status="info" />
1917
+ </Timeline>
1918
+ ```
1919
+
1920
+ **Common mistakes:**
1921
+ - ❌ `Building an activity log with a <ul> + manual dots/lines` → Use <Timeline items={[...]} /> or TimelineItem children
1922
+ - ❌ `Using Stepper for a history/audit feed` → Use <Timeline> for logs/history; Stepper for wizards
1923
+ - ❌ `Expecting Timeline to sort by time` → Sort the array yourself (newest- or oldest-first)
1924
+
1925
+ ---
1926
+
1927
+ ### TimelineItem
1928
+
1929
+ One entry in a <Timeline>. Renders a status-colored dot (or a custom icon), a title, an optional time, and optional rich content.
1930
+
1931
+ ```tsx
1932
+ import { Timeline, TimelineItem } from "@usevyre/react"
1933
+
1934
+ // Props:
1935
+ // title = ReactNode
1936
+ // time = ReactNode
1937
+ // status = "default" | "success" | "warning" | "danger" | "info" (default: default)
1938
+ // icon = ReactNode
1939
+ // children = ReactNode
1940
+
1941
+ // Examples:
1942
+ <TimelineItem title="Comment added" time="1h ago" status="default">
1943
+ <Text size="sm">“Looks good to me 👍”</Text>
1944
+ </TimelineItem>
1945
+ ```
1946
+
1947
+ **Common mistakes:**
1948
+ - ❌ `<TimelineItem> outside <Timeline>` → Always nest TimelineItem inside Timeline
1949
+
1950
+ ---
1951
+
1952
+ ### Tree
1953
+
1954
+ Hierarchical tree view for file explorers and nested navigation. DATA-DRIVEN and CONTROLLED — pass a nested `data` array; the Tree renders recursively. Single selection. A node WITH children is a folder (click toggles expand); a leaf fires onSelect. Keyboard: ArrowUp/Down move, ArrowRight/Left expand/collapse, Enter/Space select.
1955
+
1956
+ ```tsx
1957
+ import { Tree } from "@usevyre/react"
1958
+
1959
+ // Props:
1960
+ // data = TreeNode[]
1961
+ // expandedIds = string[]
1962
+ // defaultExpandedIds = string[] (default: [])
1963
+ // onExpandedChange = function
1964
+ // selectedId = string | null
1965
+ // defaultSelectedId = string | null (default: null)
1966
+ // onSelect = function
1967
+
1968
+ // Examples:
1969
+ const [sel, setSel] = useState<string | null>("src/a.ts");
1970
+
1971
+ <Tree
1972
+ data={[
1973
+ { id: "src", label: "src", children: [
1974
+ { id: "src/a.ts", label: "a.ts" },
1975
+ { id: "src/b", label: "b", children: [
1976
+ { id: "src/b/c.ts", label: "c.ts" },
1977
+ ]},
1978
+ ]},
1979
+ { id: "README.md", label: "README.md" },
1980
+ ]}
1981
+ selectedId={sel}
1982
+ onSelect={setSel}
1983
+ defaultExpandedIds={["src"]}
1984
+ />
1985
+ const [open, setOpen] = useState<string[]>(["root"]);
1986
+
1987
+ <Tree data={tree} expandedIds={open} onExpandedChange={setOpen} />
1988
+ ```
1989
+
1990
+ **Common mistakes:**
1991
+ - ❌ `Rendering a nested <ul> tree by hand with manual expand state` → Pass a nested `data` array to <Tree> and control expandedIds/selectedId
1992
+ - ❌ `onSelect={(e) => ...}` → onSelect={(id) => setSelected(id)}
1993
+ - ❌ `Mutating the data array to expand/collapse` → Track expandedIds in state (or use defaultExpandedIds)
1994
+ - ❌ `Using DropdownMenu submenus for a file tree` → Use <Tree> for file explorers / nested nav
1995
+
1996
+ ---
1997
+
1998
+ ### OTPInput
1999
+
2000
+ Segmented one-time-code input for verification / 2FA. CONTROLLED. onChange emits the STRING value (not an event), and onComplete fires once when every slot is filled. Paste-aware (pasting a full code fills all slots), auto-advance on input, backspace moves to the previous slot, arrow keys navigate. Drops straight into <FormField>.
2001
+
2002
+ ```tsx
2003
+ import { OTPInput } from "@usevyre/react"
2004
+
2005
+ // Props:
2006
+ // value = string
2007
+ // defaultValue = string (default: "")
2008
+ // onChange = function
2009
+ // onComplete = function
2010
+ // length = number (default: 6)
2011
+ // type = "numeric" | "alphanumeric" (default: numeric)
2012
+ // mask = boolean (default: false)
2013
+ // size = "sm" | "md" | "lg" (default: md)
2014
+ // disabled = boolean (default: false)
2015
+ // autoFocus = boolean (default: false)
2016
+
2017
+ // Examples:
2018
+ const [code, setCode] = useState("");
2019
+
2020
+ <OTPInput
2021
+ value={code}
2022
+ onChange={setCode}
2023
+ onComplete={(c) => verify(c)}
2024
+ autoFocus
2025
+ />
2026
+ <FormField name="otp" label="Verification code"
2027
+ rules={{ required: true, minLength: 6 }}>
2028
+ <OTPInput length={6} />
2029
+ </FormField>
2030
+ ```
2031
+
2032
+ **Common mistakes:**
2033
+ - ❌ `onChange={(e) => set(e.target.value)}` → onChange={(value) => setCode(value)}
2034
+ - ❌ `Six separate <Input> boxes wired by hand` → Use <OTPInput length={6} value onChange />
2035
+ - ❌ `Reading completion by comparing length yourself` → Use onComplete={(code) => verify(code)}
2036
+ - ❌ `type="password" to hide digits` → Use mask (type stays numeric/alphanumeric)
2037
+
2038
+ ---
2039
+
2040
+ ### Carousel
2041
+
2042
+ Accessible content slider for galleries, onboarding, and testimonials. CONTROLLED by a 0-based slide index. Compose CarouselSlide children (slide order = index). Snap scrolling, clickable dot indicators, prev/next arrows, ArrowLeft/Right keyboard, optional loop and autoPlay (autoplay pauses on hover/focus). onChange emits the index (not an event).
2043
+
2044
+ ```tsx
2045
+ import { Carousel, CarouselSlide } from "@usevyre/react"
2046
+
2047
+ // Props:
2048
+ // value = number
2049
+ // defaultValue = number (default: 0)
2050
+ // onChange = function
2051
+ // loop = boolean (default: false)
2052
+ // autoPlay = boolean (default: false)
2053
+ // interval = number (default: 5000)
2054
+ // showArrows = boolean (default: true)
2055
+ // showIndicators = boolean (default: true)
2056
+
2057
+ // Examples:
2058
+ const [i, setI] = useState(0);
2059
+
2060
+ <Carousel value={i} onChange={setI} loop>
2061
+ <CarouselSlide><img src="/a.jpg" alt="A" /></CarouselSlide>
2062
+ <CarouselSlide><img src="/b.jpg" alt="B" /></CarouselSlide>
2063
+ <CarouselSlide><img src="/c.jpg" alt="C" /></CarouselSlide>
2064
+ </Carousel>
2065
+ <Carousel autoPlay interval={4000} showArrows={false}>
2066
+ <CarouselSlide><Welcome /></CarouselSlide>
2067
+ <CarouselSlide><Features /></CarouselSlide>
2068
+ <CarouselSlide><GetStarted /></CarouselSlide>
2069
+ </Carousel>
2070
+ ```
2071
+
2072
+ **Common mistakes:**
2073
+ - ❌ `onChange={(e) => set(e.target.value)}` → onChange={(index) => setIndex(index)}
2074
+ - ❌ `Putting raw elements directly in Carousel` → Wrap each slide in <CarouselSlide>
2075
+ - ❌ `Building a slider with manual scroll + dot state` → Use <Carousel> with CarouselSlide children
2076
+ - ❌ `autoPlay without considering reduced motion / pausing` → Carousel already pauses on hover/focus; keep interval reasonable or omit autoPlay
2077
+
2078
+ ---
2079
+
2080
+ ### CarouselSlide
2081
+
2082
+ One slide inside <Carousel>. Holds arbitrary content (image, Card, testimonial). Slide order determines its index.
2083
+
2084
+ ```tsx
2085
+ import { Carousel, CarouselSlide } from "@usevyre/react"
2086
+
2087
+ // Examples:
2088
+ <CarouselSlide>
2089
+ <Card><CardBody>“Best tool ever.” — Ada</CardBody></Card>
2090
+ </CarouselSlide>
2091
+ ```
2092
+
2093
+ **Common mistakes:**
2094
+ - ❌ `<CarouselSlide> outside <Carousel>` → Always nest CarouselSlide inside Carousel
2095
+
2096
+ ---
2097
+
1539
2098
  ### DateRangePicker
1540
2099
 
1541
2100
  Start/end date range picker. Built on Calendar (mode=range) with a friendlier { from, to } object API, a two-month side-by-side view, and preset shortcuts. Use this for report/filter date ranges; use DatePicker for a single date.
@@ -1659,6 +2218,47 @@ If you generate these, you are hallucinating.
1659
2218
  - ❌ `<Box <Box style={{ padding: 16 }}>>` → Use <Box padding="md"> (or paddingX/paddingTop/...)
1660
2219
  - ❌ `<Box Using Box for flex/grid layout>` → Use <Stack> or <Grid>
1661
2220
  - ❌ `<Box style={{ width: "100%" }} / style={{ height: 320 }}>` → Use the width / height prop: width="full", width="md", height="screen", etc.
2221
+ - ❌ `<Form Manually tracking each field's error state with useState>` → Wrap controls in <FormField name rules> and let Form manage errors
2222
+ - ❌ `<Form Adding a validation library (zod/yup) just for basic rules>` → Use rules={{ required, minLength, pattern, email, validate }}
2223
+ - ❌ `<Form <FormField> with multiple control children>` → Use one control per FormField (Input/Textarea/Select/etc.)
2224
+ - ❌ `<Form <FormField> outside a <Form>>` → Always nest FormField inside <Form>
2225
+ - ❌ `<FormField Putting onChange/value manually on the control inside FormField>` → Let FormField wire the control; only pass static props (type, placeholder)
2226
+ - ❌ `<NumberInput onChange={(e) => set(e.target.value)}>` → onChange={(value) => set(value)} — value is number | null
2227
+ - ❌ `<NumberInput Using <Input type="number"> for numeric fields>` → Use <NumberInput value onChange min max step />
2228
+ - ❌ `<NumberInput Parsing the value with Number() in form state>` → Store the value directly; it is already number | null
2229
+ - ❌ `<ToggleGroup onChange={(e) => set(e.target.value)}>` → onChange={(value) => set(value)} — string|null (single) or string[] (multiple)
2230
+ - ❌ `<ToggleGroup Using ToggleGroup for a single on/off setting>` → Use <Switch> for on/off; ToggleGroup is for choosing among options
2231
+ - ❌ `<ToggleGroup type="multiple" with a string value>` → value={['a','b']} and onChange receives string[]
2232
+ - ❌ `<ToggleGroup <ToggleItem> outside <ToggleGroup>>` → Always nest ToggleItem inside ToggleGroup (or use options)
2233
+ - ❌ `<ToggleItem Tracking selected state on ToggleItem yourself>` → Only set value; the group controls selected state
2234
+ - ❌ `<Stepper Using Tabs for a wizard / checkout flow>` → Use <Stepper> with StepperNav + Step + StepPanel
2235
+ - ❌ `<Stepper onChange={(e) => set(e.target.value)}>` → onChange={(index) => setStep(index)}
2236
+ - ❌ `<Stepper Manually toggling which panel is visible>` → Give each StepPanel an index; Stepper shows the active one
2237
+ - ❌ `<Stepper <Step> or <StepPanel> outside <Stepper>>` → Nest Step inside StepperNav, StepPanel inside Stepper
2238
+ - ❌ `<EmptyState Building an empty placeholder with a bare <div> + centered text>` → Use <EmptyState title description variant>
2239
+ - ❌ `<EmptyState action / cta prop>` → Put the Button as children of EmptyState
2240
+ - ❌ `<EmptyState Using EmptyState for a loading state>` → Use <Skeleton> while loading; EmptyState when the result set is empty
2241
+ - ❌ `<Stat Assuming trend flips the arrow direction>` → delta="-0.4%" always shows a down arrow; trend="up" just colors it green
2242
+ - ❌ `<Stat Building a KPI card with Card + manual layout>` → Use <Stat label value delta trend />
2243
+ - ❌ `<Stat Laying out a KPI row with custom flex + dividers>` → Wrap the Stats in <StatGroup>
2244
+ - ❌ `<StatGroup Putting non-Stat children in StatGroup>` → Only place <Stat> elements inside StatGroup
2245
+ - ❌ `<Timeline Building an activity log with a <ul> + manual dots/lines>` → Use <Timeline items={[...]} /> or TimelineItem children
2246
+ - ❌ `<Timeline Using Stepper for a history/audit feed>` → Use <Timeline> for logs/history; Stepper for wizards
2247
+ - ❌ `<Timeline Expecting Timeline to sort by time>` → Sort the array yourself (newest- or oldest-first)
2248
+ - ❌ `<TimelineItem <TimelineItem> outside <Timeline>>` → Always nest TimelineItem inside Timeline
2249
+ - ❌ `<Tree Rendering a nested <ul> tree by hand with manual expand state>` → Pass a nested `data` array to <Tree> and control expandedIds/selectedId
2250
+ - ❌ `<Tree onSelect={(e) => ...}>` → onSelect={(id) => setSelected(id)}
2251
+ - ❌ `<Tree Mutating the data array to expand/collapse>` → Track expandedIds in state (or use defaultExpandedIds)
2252
+ - ❌ `<Tree Using DropdownMenu submenus for a file tree>` → Use <Tree> for file explorers / nested nav
2253
+ - ❌ `<OTPInput onChange={(e) => set(e.target.value)}>` → onChange={(value) => setCode(value)}
2254
+ - ❌ `<OTPInput Six separate <Input> boxes wired by hand>` → Use <OTPInput length={6} value onChange />
2255
+ - ❌ `<OTPInput Reading completion by comparing length yourself>` → Use onComplete={(code) => verify(code)}
2256
+ - ❌ `<OTPInput type="password" to hide digits>` → Use mask (type stays numeric/alphanumeric)
2257
+ - ❌ `<Carousel onChange={(e) => set(e.target.value)}>` → onChange={(index) => setIndex(index)}
2258
+ - ❌ `<Carousel Putting raw elements directly in Carousel>` → Wrap each slide in <CarouselSlide>
2259
+ - ❌ `<Carousel Building a slider with manual scroll + dot state>` → Use <Carousel> with CarouselSlide children
2260
+ - ❌ `<Carousel autoPlay without considering reduced motion / pausing>` → Carousel already pauses on hover/focus; keep interval reasonable or omit autoPlay
2261
+ - ❌ `<CarouselSlide <CarouselSlide> outside <Carousel>>` → Always nest CarouselSlide inside Carousel
1662
2262
  - ❌ `<DateRangePicker value={[from, to]}>` → Use value={{ from, to }} and read range.from / range.to
1663
2263
  - ❌ `<DateRangePicker DateRangePicker for a single date>` → Use <DatePicker /> for a single date
1664
2264
  - ❌ `<DateRangePicker presets="true" (string)>` → Use the bare prop: presets (or presets={true})