feat: add optional hint prop to form fields#1139
Open
Alastair Fraser (alastair-simon) wants to merge 1 commit into
Open
feat: add optional hint prop to form fields#1139Alastair Fraser (alastair-simon) wants to merge 1 commit into
Alastair Fraser (alastair-simon) wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
hint prop to form fields33751bb to
42f6c8c
Compare
refactor: create mt-field-hint component and refactor fields feat: create mt-field-hint component refactor: implement figma design style: code format test: fix mt-textarea story update snapshots
42f6c8c to
2ddd08d
Compare
Contributor
|
Would be nice to add a visual test with slot usage. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Closes #1062
Form fields now accept an optional hint string (with an existing #hint slot still available, and the slot winning when both are used) and show that caption under the field with the standard info icon via mt-field-hint.
Why?
Product and admin UIs need short, consistent helper text under inputs without every consumer hand-rolling markup, layout, and the info icon.
How?
Parents expose a hint prop plus #hint, compute showFieldHint from non-empty prop text or a present hint slot (with mt-unit-field only forwarding #hint when the wrapper actually provides it), gate mt-field-hint with v-if, and keep mt-select/mt-select-base wired so the select wraps hint content the same way.
Testing?
Existing visual tests pass