Skip to content

Allow user to configure separate minimum fraction digits from maximum fraction digits #1401

@seancolsen

Description

@seancolsen

Current behavior

  • For Number and Money UI types, the API supports two display options: minimum_fraction_digits and maximum_fraction_digits.

  • When formatting the cell values, these two display options are passed into Intl.NumberFormat as minimumFractionDigits and maximumFractionDigits.

  • The use-case for having two separate values is as follows:

    Let's pretend I'm storing money amounts in USD and I have the following values:

    dollars
    1.4
    2.8191

    Also, for my task at-hand I'd like to see the full values, with all their stored precision, but I don't happen to know the maximum number of decimal places in my data set (and indeed it could change as I add new data). For this reason I don't want to set a maximum number of decimal places. But I do want to set a minimum number of decimal places to 2 because it's currency. I'd like to see:

    dollars
    $1.40
    $2.8191
  • However, currently our type configuration UI, lumps these separate values into the same singular "Decimal Places" field as shown below.

    image

    When the user enters a value into that field it gets written to minimum_fraction_digits and maximum_fraction_digits in tandem. And if the API happens to have different values for the field, the UI form is populated with the maximum of the two.

Design goals

  • The type configuration UI allows the user to set different values for minimum_fraction_digits and maximum_fraction_digits.

  • It should be possible for one or both values to be blank (null).

  • In most cases, the user will be likely to want only one value, and our UI should make it easy for the user to set both values identically without thinking too deeply about it.

  • It should not be possible for maximum_fraction_digits to be less than minimum_fraction_digits, but we already have back-end validation in-place for that, so we may not necessarily need client-side validation for it.

Related tickets

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs: ux designtemp: discussThis issue n eeds discussion to resolve - part of the Oct 2025 backlog grooming process.type: enhancementwork: frontendRelated to frontend code in the mathesar_ui directory

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions