@datawire-ai/busyfile-design-library 1.8.0 → 1.9.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.
- package/README.md +48 -0
- package/dist/index.js +4163 -2123
- package/dist/index.umd.cjs +67 -27
- package/dist/style.css +1 -1
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -324,6 +324,54 @@ export default function Example() {
|
|
|
324
324
|
| `showControls` | `boolean` | `true` | Show back/next navigation controls |
|
|
325
325
|
| `className` | `string` | `undefined` | Additional Tailwind classes |
|
|
326
326
|
|
|
327
|
+
### SelectOption
|
|
328
|
+
A custom dropdown supporting single, multi(with chips), and grouped selections. Built with React and Tailwind CSS.
|
|
329
|
+
|
|
330
|
+
### Usage
|
|
331
|
+
```import { useState } from "react"
|
|
332
|
+
import { SelectOption } from "@/components/select-option"
|
|
333
|
+
|
|
334
|
+
const options = [
|
|
335
|
+
{ label: "Option 1", value: "opt1" },
|
|
336
|
+
{ label: "Option 2", value: "opt2" },
|
|
337
|
+
]
|
|
338
|
+
|
|
339
|
+
export default function Demo() {
|
|
340
|
+
const [single, setSingle] = useState("")
|
|
341
|
+
const [multi, setMulti] = useState<string[]>([])
|
|
342
|
+
|
|
343
|
+
return (
|
|
344
|
+
<>
|
|
345
|
+
<SelectOption
|
|
346
|
+
options={options}
|
|
347
|
+
value={single}
|
|
348
|
+
onChange={val => setSingle(val as string)}
|
|
349
|
+
placeholder="Single select"
|
|
350
|
+
/>
|
|
351
|
+
|
|
352
|
+
<SelectOption
|
|
353
|
+
options={options}
|
|
354
|
+
multiple
|
|
355
|
+
value={multi}
|
|
356
|
+
onChange={val => setMulti(val as string[])}
|
|
357
|
+
placeholder="Multi select"
|
|
358
|
+
/>
|
|
359
|
+
</>
|
|
360
|
+
)
|
|
361
|
+
}; ```
|
|
362
|
+
|
|
363
|
+
### Props
|
|
364
|
+
|
|
365
|
+
| Prop | Type | Default | Description |
|
|
366
|
+
| ------------- | ----------------------------------------- | ------------- | ------------------------------------------ |
|
|
367
|
+
| `options` | `SelectOptionType[] \| SelectGroupType[]` | required | List of options (flat or grouped) |
|
|
368
|
+
| `multiple` | `boolean` | `false` | Enables multi-select with chips |
|
|
369
|
+
| `placeholder` | `string` | `"Select..."` | Placeholder text when no value is selected |
|
|
370
|
+
| `disabled` | `boolean` | `false` | Disables the select |
|
|
371
|
+
| `error` | `string` | `undefined` | Error message, highlights border |
|
|
372
|
+
| `helperText` | `string` | `undefined` | Helper text shown below the select |
|
|
373
|
+
| `value` | `string \| string[]` | internal | Controlled value |
|
|
374
|
+
| `onChange` | `(value: string \| string[]) => void` | optional | Callback when value changes |
|
|
327
375
|
|
|
328
376
|
|
|
329
377
|
### TypeScript
|