@ncdai/react-wheel-picker 1.0.5 → 1.0.6
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 +78 -0
- package/package.json +1 -1
- /package/{LICENSE.md → LICENSE} +0 -0
package/README.md
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# React Wheel Picker
|
|
2
|
+
|
|
3
|
+
iOS-like wheel picker for React with smooth inertia scrolling and infinite loop support.
|
|
4
|
+
|
|
5
|
+
Check out the live demo: https://chanhdai.com/blog/react-wheel-picker
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
To start using the library, install it in your project:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pnpm add @ncdai/react-wheel-picker
|
|
13
|
+
# or
|
|
14
|
+
yarn add @ncdai/react-wheel-picker
|
|
15
|
+
# or
|
|
16
|
+
npm install @ncdai/react-wheel-picker
|
|
17
|
+
# or
|
|
18
|
+
bun add @ncdai/react-wheel-picker
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Add the core CSS to your app's entry point (e.g., `src/app/layout.tsx`, `src/main.tsx`, or `src/index.tsx`):
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
import "@ncdai/react-wheel-picker/style.css";
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
> This CSS includes only basic layout. Use classNames to customize visuals (see below).
|
|
28
|
+
|
|
29
|
+
Use the component in your app:
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
import {
|
|
33
|
+
WheelPicker,
|
|
34
|
+
WheelPickerWrapper,
|
|
35
|
+
type WheelPickerOption,
|
|
36
|
+
type WheelPickerClassNames,
|
|
37
|
+
} from "@ncdai/react-wheel-picker";
|
|
38
|
+
|
|
39
|
+
const options: WheelPickerOption[] = [
|
|
40
|
+
{
|
|
41
|
+
label: "React",
|
|
42
|
+
value: "react",
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
label: "Vue",
|
|
46
|
+
value: "vue",
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
label: "Angular",
|
|
50
|
+
value: "angular",
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
label: "Svelte",
|
|
54
|
+
value: "svelte",
|
|
55
|
+
},
|
|
56
|
+
];
|
|
57
|
+
|
|
58
|
+
const classNames: WheelPickerClassNames = {
|
|
59
|
+
optionItem: "text-zinc-400",
|
|
60
|
+
highlightWrapper: "bg-zinc-100 text-zinc-950",
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export function WheelPickerDemo() {
|
|
64
|
+
return (
|
|
65
|
+
<WheelPickerWrapper className="max-w-56 rounded-md border border-zinc-200 bg-white shadow-xs">
|
|
66
|
+
<WheelPicker options={options} classNames={classNames} />
|
|
67
|
+
</WheelPickerWrapper>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Documentation
|
|
73
|
+
|
|
74
|
+
Find the full API reference in the [documentation](https://react-wheel-picker.chanhdai.com/docs/getting-started).
|
|
75
|
+
|
|
76
|
+
## License
|
|
77
|
+
|
|
78
|
+
Licensed under the [MIT license](./LICENSE).
|
package/package.json
CHANGED
/package/{LICENSE.md → LICENSE}
RENAMED
|
File without changes
|