simplified prop types for dash toolchain#685
Merged
AnnMarieW merged 4 commits intosnehilvj:masterfrom Jan 22, 2026
Merged
Conversation
This reverts commit 9199ce6.
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.
Partially addresses #559
See more details in an alternate PR #686 which was closed in favor of this one.
This PR simplifies the Mantine style props
See also the DMC Style Prop docs
The style props include Mantine types such as
MantineSizeandMantineColor. These are complex types that include literals andstring & {}in the type definition. Dash dash does not parse those correctly when creating Python types.Background:
DMC extensively uses prop types that look like this:
size?: MantineSize | number;The
MantineSizetype includes sizes defined in the theme object andstring & {}, which enables literal type hints while still allowing arbitrary strings.Dash cannot handle the
string & {}pattern, so it is ignored. As a result, Dash generates the following Python type, which does not allow arbitrary strings:If it's changed to this:
it drops the
MantineSizedefinitions.This fixes the typing issue in Dash, but we lose the type hints for the Mantine literals.
Mantine Style Props - responsive styles:
The Mantine Style props also accept a dict with breakpoints for responsive styles. The type is defined as
Partial<Record<MantineBreakpointThis is dropped by dash.I tried defining the breakpoint dict like this:
Record<string, string>but dash just drops this as well. For simplicity the breakpoint dicts are typed asobjectin this PR.