maxmarcon / live_select

Dynamic (multi)selection field for LiveView
https://hex.pm/packages/live_select
Apache License 2.0
186 stars 35 forks source link

Add css config for clear button #40

Closed damir closed 1 year ago

damir commented 1 year ago

Hi Max,

There is no option to configure css class for clear button, it looks like this when switching to dark mode:

Screenshot 2023-09-17 at 2 26 06 PM
maxmarcon commented 1 year ago

Hi @damir . Good point, there isn't an option for that atm!

I will add it as soon as I find some time.

In the meantime you can add a css rule as workaround. Something like this should work:

div[phx-hook=LiveSelect] button[phx-click=clear] {
   color: white
}

Let me know if you could make it work.

maxmarcon commented 1 year ago

Note to self with additional TODOs:

  1. apply relative position to clear button's parent, so it is positioned correctly even with style=none
  2. do not apply relative position to entire liveselect component when style=tailwind, as it's useless
damir commented 1 year ago

That works, thanks for the hint! I am using petal components and it looks like this:

html.dark div[phx-hook='LiveSelect'] button[phx-click='clear'] {
  @apply text-gray-500;
}
maxmarcon commented 1 year ago

added to release 1.2.0.

The option is called: clear_button_class