Range Component: Centered labels on the slider #3234
Answered
by
saadeghi
fredbradley
asked this question in
Q&A
-
Beta Was this translation helpful? Give feedback.
Answered by
saadeghi
Oct 16, 2024
Replies: 1 comment 3 replies
-
Can you share the code on Tailwind Play? |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here's an example: https://play.tailwindcss.com/GMTyPd5pql
I used grid instead of flex so all 5 columns get equal width. We want the range thumb to be aligned with the line from first item and last item, and there are 5 columns which means we need 10% horizontal margin for the range + the size of thumb (which is 32px). So
w-[calc(80%+32px)]
would make range fit exactly to the scale.Let me know if you have a question.