Skip to content

Conversation

@matyasf
Copy link
Collaborator

@matyasf matyasf commented Nov 27, 2025

Convert NumberInput to the new theming system. Notes:

  • Converted NumberInput from class-based to functional component
  • It uses the theme from TextInput, they are the same in Figma
  • The styling of the upper label/messages are not done, they are coming in FormFieldLayout

Tokens are also not fully used (because they are used only in TextInput):

  • fontSizeSm, heightSm, paddingHorizontalSm: This component has no small size
  • gapContent: This is a gap between the text and elements rendered after it, NumberInput does not have such

To test:

  • check the examples in the docs, they should function exactly as before
  • compare its CSS to the ones in Figma

@matyasf matyasf self-assigned this Nov 27, 2025
transition: 'outline-color 0.2s, outline-offset 0.25s'
}),
outlineOffset: '-0.8rem',
outlineStyle: 'solid',
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a small fix for the focus outline not showing because CSS styles were reset by FormFieldLayout

Comment on lines 75 to 85
* Not visible when `disabled` or `readonly`
*/
placeholder?: string

/**
* Whether or not the text input is required.
*/
isRequired?: boolean

/**
* Whether or not to display the up/down arrow buttons.
* They are not visible when `readonly`
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these are visual changes requested by design

@matyasf matyasf force-pushed the numberinput_rework branch 2 times, most recently from 7d22854 to 82c3075 Compare November 27, 2025 22:06
Copy link
Collaborator

@adamlobler adamlobler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, I just left two minor comments related to the arrow icon colors. Other than that, the labels and message colors/sizes seem a bit strange, but I assume that will be handled in the formField component.

{customIcons?.increase ? (
callRenderProp(customIcons.increase)
) : (
<IconArrowOpenUpLine />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should define the icon colors here for each state, now it stays black in every theme and state.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've fixed this, good catch

{customIcons?.decrease ? (
callRenderProp(customIcons.decrease)
) : (
<IconArrowOpenDownLine />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should define the icon colors here for each state, now it stays black in every theme and state.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've fixed this, good catch

@matyasf matyasf force-pushed the numberinput_rework branch 3 times, most recently from 19d6593 to e85ac1b Compare November 28, 2025 16:45
@matyasf matyasf requested a review from adamlobler November 28, 2025 16:46
Comment on lines +98 to +101
const [upButtonState, setUpButtonState] = useState<ArrowButtonColors>(
'actionSecondaryBaseColor'
)
const [downButtonState, setDownButtonState] = useState<ArrowButtonColors>(
'actionSecondaryBaseColor'
Copy link
Collaborator Author

@matyasf matyasf Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is quite an ugly way to handle the buttons state, but the original code had this as <button> and I did not want to change it. Its needed because the new design adds hover/down states to the icons

@matyasf matyasf force-pushed the numberinput_rework branch 2 times, most recently from d783b68 to 67c31f8 Compare November 28, 2025 20:43
@github-actions
Copy link

github-actions bot commented Nov 28, 2025

PR Preview Action v1.6.3

🚀 View preview at
https://instructure.design/pr-preview/pr-2271/

Built to branch gh-pages at 2025-12-01 21:20 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

),
'@instructure/ui-grid$': path.resolve(import.meta.dirname, '../ui-grid/src/'),
'@instructure/ui-i18n$': path.resolve(import.meta.dirname, '../ui-i18n/src/'),
'@instructure/ui-icons-lucide': path.resolve(import.meta.dirname, '../ui-icons-lucide/src/'),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this fix recompiles + reloads docs when one changes something in this package

return (
<span css={styles?.lucideIcon} className={className} style={style}>
<Icon
name={Icon.displayName}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some unit tests target these by the display name

Copy link
Collaborator

@adamlobler adamlobler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the modification to the arrows, it looks great! 🙌 I found 2 minor things in the showcase, but other than that its okay to merge from my side.

<NumberInput
renderLabel='has error'
placeholder="placeholder"
messages={[{ text: 'This is an error.', type: 'error' }]}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m not sure about this, but as far as I know, this error message is the legacy format that users shouldn’t use. If that’s true, then we should show the newError message here instead.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is part of FormField and not this component, we will fix it there. (and AFAIK type: 'error will be the new error, and we'lll remove the old type error)

<NumberInput renderLabel="Default-size input" /><br/>
<NumberInput size="large" renderLabel="Large-size input" />
</div>
<Flex gap='2rem' direction='column'>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "gap" doesn't apply the raw value here for some reason, we should use gap='medium' instead.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch, fixed it

@matyasf matyasf force-pushed the numberinput_rework branch from 67c31f8 to 9c7066c Compare December 1, 2025 08:54
@matyasf matyasf requested a review from adamlobler December 1, 2025 08:56
Copy link
Contributor

@joyenjoyer joyenjoyer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gj

@matyasf matyasf force-pushed the numberinput_rework branch 2 times, most recently from 741fcb3 to 92082f5 Compare December 1, 2025 21:05
- Converted `NumberInput` from class-based to functional component
- It uses the theme from TextInput, they are the same in Figma
- The styling of the upper label/messages are not done, they are coming
 in `FormFieldLayout`

Tokens are also not fully used (they are used only in `TextInput`):

- `fontSizeSm`, `heightSm`, `paddingHorizontalSm`: This component has no
 small size
- `gapContent`: This is a gap between the text and elements rendered
 after it, `NumberInput` does not have such

To test:

- Check the examples in the docs, they should function exactly as before
- Compare its CSS to the ones in Figma

Completes INSTUI-4814
@matyasf matyasf force-pushed the numberinput_rework branch from 92082f5 to fa66e5a Compare December 1, 2025 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants