Coder Social home page Coder Social logo

React hook form about shadcn-tag-input HOT 3 CLOSED

Codemaine avatar Codemaine commented on August 28, 2024
React hook form

from shadcn-tag-input.

Comments (3)

JaleelB avatar JaleelB commented on August 28, 2024 1

Hey @Codemaine. I'll take a look at this today

from shadcn-tag-input.

JaleelB avatar JaleelB commented on August 28, 2024 1

@Codemaine Thank you for your suggestion and for engaging with the development of the component. After carefully considering the proposal to integrate React Hook Form's control and rules directly into TagInput, I have decided to not integrate the change. There isn't a compelling reason to tightly couple the TagInput with React Hook Form by handling control and rules directly, it's generally better to use Controller. This approach keeps the component flexible and clean, focusing on its primary functionalities while relying on React Hook Form to handle form state and validation externally

from shadcn-tag-input.

Codemaine avatar Codemaine commented on August 28, 2024

I've found a temporary solution:
<Controller name="tags" control={control} rules={{ required: true }} render={({ field }) => <TagInput placeholder="Enter a topic" tags={tags} id="tags" maxTags={5} minTags={2} value={field.value} setTags={(newTags) => { setTags(newTags); field.onChange(newTags) }} title="Select up to 5 tags" />} />

from shadcn-tag-input.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.