1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

shadcnのSliderで値が変更できない

Posted at

はじめに

shadcnを使って値を更新するのに時間がかかったのでまとめておきます

問題

以下のコンポーネントを利用して値の更新を実装しました。

<Slider
  defaultValue={[150]}
  max={1000}
  step={50}
  onChange={(value: number[]) => setWordCount(value[0])}
/>

しかしなぜか値は更新できずChatGPTに聴いても上手く活きませんでした

解決方法

onValueChangeを使うことで更新が可能です

                    <Slider
                      defaultValue={[150]}
                      max={1000}
                      step={50}
                      onValueChange={(value) => setWordCount(value[0])}
                    />

おわりに

独自の名前にするならドキュメントに書いてほしいなと思ってしまいます。

参考

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?