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

Pass Through Props: Syntactic improvement suggestion #4125

Closed
andythefox opened this issue Jul 11, 2023 · 1 comment
Closed

Pass Through Props: Syntactic improvement suggestion #4125

andythefox opened this issue Jul 11, 2023 · 1 comment
Assignees
Labels
Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add
Milestone

Comments

@andythefox
Copy link

Describe the feature you would like to see added

The PT feature is a great tool for styling components and the new Unstyled Mode is a reasonable addition to that. But the required syntax for using PT is a bit cumbersome. Most of the time you want to add style classes using the class prop/attribute with a fixed string value.

Here is an example from the Unstyled Mode documentation:

app.use(PrimeVue, { 
    pt: {
        button: {
            root: { class: 'bg-teal-500 hover:bg-teal-700 cursor-pointer text-white p-3 border-round border-none flex gap-2' },
            label: { class: 'text-white font-bold text-xl' },
            icon: { class: 'text-white text-2xl' }
        },
        panel: {
            header: { class: 'bg-primary border-primary' },
            content: { class: 'border-primary text-lg text-primary-700' },
            title: { class: 'bg-primary text-xl' },
            toggler: { class: 'bg-primary hover:bg-primary-reverse' }
        }
    } 
});

The point is, you have to repeat the { class: '...' } all the time.

I would suggest the simplification that if you only want to specify the class prop, you can omit the object syntax and directly use the string values. So the above example can be rewritten as:

app.use(PrimeVue, { 
    pt: {
        button: {
            root: 'bg-teal-500 hover:bg-teal-700 cursor-pointer text-white p-3 border-round border-none flex gap-2',
            label: 'text-white font-bold text-xl',
            icon: 'text-white text-2xl'
        },
        panel: {
            header: 'bg-primary border-primary',
            content: 'border-primary text-lg text-primary-700',
            title: 'bg-primary text-xl',
            toggler: 'bg-primary hover:bg-primary-reverse'
        }
    } 
});

Is your feature request related to a problem?

No response

Describe the solution you'd like

No response

Describe alternatives you have considered

No response

Additional context

No response

@andythefox andythefox added Status: Discussion Issue or pull request needs to be discussed by Core Team Type: New Feature Issue contains a new feature or new component request labels Jul 11, 2023
@mertsincan mertsincan self-assigned this Jul 11, 2023
@mertsincan
Copy link
Member

Nice feedback, I'll add it to next version.

@mertsincan mertsincan added this to the 3.30.1 milestone Jul 11, 2023
@mertsincan mertsincan added Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add and removed Status: Discussion Issue or pull request needs to be discussed by Core Team Type: New Feature Issue contains a new feature or new component request labels Jul 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add
Projects
None yet
Development

No branches or pull requests

2 participants