Skip to content
This repository has been archived by the owner on Sep 27, 2023. It is now read-only.

Needs native label support #2

Open
tomayac opened this issue Sep 2, 2019 · 2 comments
Open

Needs native label support #2

tomayac opened this issue Sep 2, 2019 · 2 comments

Comments

@tomayac
Copy link
Member

tomayac commented Sep 2, 2019

Ideally something like…

<input-knob id="KnobbyMcKnobface"></input-knob>
<input-knob-label for="KnobbyMcKnobface">
  <input-knob-mark value="1">1%</input-knob-mark>
  <input-knob-mark value="2">2%</input-knob-mark>
  <input-knob-mark value="3">3%</input-knob-mark>
  <!-- -->
</input-knob-label>

Each <input-knob-mark> should set the <input-knob> to the corresponding value attribute's value.

Currently, building this by hand is tedious, but maybe an approach like I took here might help a bit automate the annoying parts.

<svg viewBox="0 0 100 100">
    <path fill="transparent" id="circle" d="M17,50a33,33 0 1,0 66,0a33,33 0 1,0 -66,0"/>
    <text letter-spacing="26px">
      <textPath xlink:href="#circle">12345</textPath>
    </text>
</svg> 

Using this letter-spacing hack obviously breaks the moment your mark needs to be something more than one character. It's also non-semantic. And requires math to calculate the actual letter-spacing value. Just fix it and provide something better ;-)

Edit: the semantic grouping works by using <tspan>s, but they don't do what I want them yet.

@rowan-m
Copy link
Contributor

rowan-m commented Sep 3, 2019

This is definitely on the list! My intent here is to use the same approach as input type="range"> and allow the use of a <datalist> to specify tick marks.

As per: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/range

<input type="range" list="tickmarks">

<datalist id="tickmarks">
  <option value="0" label="0%"></option>
  <option value="10"></option>
  <option value="20"></option>
  <option value="30"></option>
  <option value="40"></option>
  <option value="50" label="50%"></option>
  <option value="60"></option>
  <option value="70"></option>
  <option value="80"></option>
  <option value="90"></option>
  <option value="100" label="100%"></option>
</datalist>

@tomayac
Copy link
Member Author

tomayac commented Sep 3, 2019

Fully agree, <datalist> is the way to go, nothing new is required 🎉. Now all we need is a way to make the <option>s to flow nicely around the <input-knob>.

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

No branches or pull requests

2 participants