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

Select: Placeholder theming configuration has no effect #1276

Closed
NilsEvers opened this issue Jan 23, 2024 · 8 comments
Closed

Select: Placeholder theming configuration has no effect #1276

NilsEvers opened this issue Jan 23, 2024 · 8 comments
Labels
bug Something isn't working

Comments

@NilsEvers
Copy link

NilsEvers commented Jan 23, 2024

Environment

  • Operating System: Darwin
  • Node Version: v21.5.0
  • Nuxt Version: 3.9.1
  • CLI Version: 3.10.0
  • Nitro Version: 2.8.1
  • Package Manager: npm@10.2.4
  • Builder: -
  • User Config: modules, ssr, devtools, typescript, imports, ui,
  • Runtime Modules: @nuxt/ui@2.12.0, @nuxtjs/i18n@8.0.0
  • Build Modules: -

Version

v2.12.0

Reproduction

https://stackblitz.com/edit/nuxt-ui-isptnw?file=app.vue

Description

Theming the placeholder of the select component has no effect.

<USelect
  placeholder="This text should be red"
  :ui="{ placeholder: 'text-red-600 dark:text-red-600' }"
/>

In addition, the default style of the placeholder is kind of off compared to regular input fields

@NilsEvers NilsEvers added the bug Something isn't working label Jan 23, 2024
Copy link
Member

There is a typo in your example: placholder -> placeholder.

@NilsEvers
Copy link
Author

Sorry! I've updated the example.

The issue is not related to the typo though.

Copy link
Member

You're absolutely right, the ui.placeholder is not taken into account on the Select component 🤔

Copy link
Member

benjamincanac commented Jan 23, 2024

The reason is that the placeholder doesn't work the same on a <select> and cannot be styled like an <input>. The text-gray-900 dark:text-white from the white color is what's styling the select. The placeholder key should not exist in the select config.

Here's how you can change the color of the Select:

<USelect
  placeholder="This text should be red"
  :options="countries"
  :ui="{ color: { white: { outline: 'text-red-600 dark:text-red-600' } } }"
/>

@NilsEvers
Copy link
Author

Thank you for the suggestion, but this would also change the color for the text when a value is selected.

I think that a separate color for the placeholder as well as a consistent style for the different input elements would be really beneficial.

@NilsEvers
Copy link
Author

If you don't want to change the implementation to be more inline with the default <select> element (which has no placeholder), how about moving the placeholder key to the SelectMenu component?

This could be easily applied here.

Copy link
Member

Here you go! I've applied the placeholder to the button / select when a placeholder prop is passed and nothing is selected.

@NilsEvers
Copy link
Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants