observablehq / inputs

Better input elements
https://observablehq.com/framework/lib/inputs
ISC License
125 stars 34 forks source link

Inputs.text: add support for HTML size attribute #260

Open borango opened 7 months ago

borango commented 7 months ago

For inputs of type text, with a known limited size of characters, I find it useful to restrict the width of the input via the HTML size attribute.

In the API documentation the size property is not documented and I found that it does not have any effect if I try to provide it in the constructor e.g. Inputs.text( { size:4 } ) or Inputs.text( { size:"4" } )

So I wish that Inputs.text() would pass through the optional size attribute and render it as the standard HTML attribute for the resulting <input> element, like so: <input type="text" ... size="4">