Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: Allow to pass label and description via props #964

Open
2 tasks done
thewebartisan7 opened this issue Dec 17, 2024 · 2 comments
Open
2 tasks done

[Feature]: Allow to pass label and description via props #964

thewebartisan7 opened this issue Dec 17, 2024 · 2 comments

Comments

@thewebartisan7
Copy link

thewebartisan7 commented Dec 17, 2024

Describe the feature

Right now we have many components for input, example:

          <FormField v-slot="{ componentField }" name="name">
            <FormItem>
              <FormLabel>Name</FormLabel>

              <FormControl>
                <Input
                  type="text"
                  placeholder="Your name"
                  v-bind="componentField"
                />
              </FormControl>

              <FormDescription>
               This is your public display name.
              </FormDescription>

              <FormMessage />
            </FormItem>
          </FormField>

We can reduce by passing, optionally, the label and description via props, and also the error is display conditionally instead of description, such avoiding to have description and error which doesn't looks good.

          <FormField v-slot="{ componentField }" name="name">
            <FormItem
              label="Name"
              description="This is your public display name."
            >
              <FormControl>
                <Input
                  type="text"
                  placeholder="How we can call you?"
                  v-bind="componentField"
                  autofocus
                />
              </FormControl>
            </FormItem>
          </FormField>

I open this issue since was required in order to open PR which is here.

Additional information

  • I intend to submit a PR for this feature.
  • I have already implemented and/or tested this feature.
@Saeid-Za
Copy link
Contributor

Hello! Thank you for your contribution!
The philosophy of ShadCN is centered around providing unopinionated (or less opinionated) building blocks that empower developers to create their own custom (opinionated around their needs) components.
Any modification of the source code that would result in it being more opinionated (like the abstraction you coded) IMO is not aligned with this strategy.
This could be a valuable as an example though.

@rasensio
Copy link

The unopinionated philosophy is understandable but compromises always has to happen. This is literally why I'm probably not going to use this framework. Is too complicated to make a simple form. See for example Quasar, it only requires a :rules="XYZ" function in each field and that's it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants