fractionInput or mathInput type="fraction"

Would be nice to have something that renders two math input boxes separated by a vinculum, with properties that all access to the numerator and denominator individually.

@Jen_Nimtz Here’s something from openmiddle that you requested. Would look way nicer with a fraction input.

Added a feature request.

I released a new dev version with a fraction input. This works.

<fractionInput name="frac">
  <label>Enter fraction</label>
</fractionInput>

<p>Value of fraction: $frac</p>
<p>Numerator: $frac.numerator</p>
<p>Denominator: $frac.denominator</p>

Let me know if this works or how it can be improved. Once we are happy with it, we can release a new version to make it available for everyone.

a cartoon scene with the words " and there was much rejoicing " above it

I can’t get the vinculum to appear…

Edit: Doesn’t show up in Chrome, Safari or Brave browsers.

Try again with the version I just released now. It should say 0.7.20-dev.20260621024358.b2bdb5a for the version.

This is much appreciated! I was just thinking about how I was going create some fraction activities later this summer.

Bar shows up now :slight_smile:

Could we get a width attribute? In fact, most of/all the attributes from mathInput would seem reasonable to apply to fractionInput as well.

<fractionInput minComponentWidth="50"> should get set the minimum width of each component of the fraction, similar to the minWidth attribute of a math input.

Comparing the documentation page of the components and looking at their attributes, I see that fraction input is missing these attributes:

  • additionalFunctionNames
  • hideNaN
  • prefillLatex
  • removedFunctionNames
  • removeStrings
  • resetFunctionNames
  • showPreview

These attributes are also missing from a matrix input, which is what I used to base fraction input from. Should we add all these attributes to fraction input and matrix input? I don’t know that there is any particular reason why these are missing.