ThemePanel is toggleable with bool in Theme (#2675)
* ThemePanel is toggleable with bool in Theme * change prop name to theme_panel
This commit is contained in:
parent
980834605b
commit
9d051d383e
@ -149,13 +149,18 @@ class Theme(RadixThemesComponent):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create(
|
def create(
|
||||||
cls, *children, color_mode: LiteralAppearance | None = None, **props
|
cls,
|
||||||
|
*children,
|
||||||
|
color_mode: LiteralAppearance | None = None,
|
||||||
|
theme_panel: bool = False,
|
||||||
|
**props,
|
||||||
) -> Component:
|
) -> Component:
|
||||||
"""Create a new Radix Theme specification.
|
"""Create a new Radix Theme specification.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
*children: Child components.
|
*children: Child components.
|
||||||
color_mode: map to appearance prop.
|
color_mode: Map to appearance prop.
|
||||||
|
theme_panel: Whether to include a panel for editing the theme.
|
||||||
**props: Component properties.
|
**props: Component properties.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
@ -163,6 +168,8 @@ class Theme(RadixThemesComponent):
|
|||||||
"""
|
"""
|
||||||
if color_mode is not None:
|
if color_mode is not None:
|
||||||
props["appearance"] = color_mode
|
props["appearance"] = color_mode
|
||||||
|
if theme_panel:
|
||||||
|
children = [ThemePanel.create(), *children]
|
||||||
return super().create(*children, **props)
|
return super().create(*children, **props)
|
||||||
|
|
||||||
def _get_imports(self) -> imports.ImportDict:
|
def _get_imports(self) -> imports.ImportDict:
|
||||||
|
@ -265,6 +265,7 @@ class Theme(RadixThemesComponent):
|
|||||||
cls,
|
cls,
|
||||||
*children,
|
*children,
|
||||||
color_mode: Optional[LiteralAppearance | None] = None,
|
color_mode: Optional[LiteralAppearance | None] = None,
|
||||||
|
theme_panel: Optional[bool] = False,
|
||||||
has_background: Optional[Union[Var[bool], bool]] = None,
|
has_background: Optional[Union[Var[bool], bool]] = None,
|
||||||
appearance: Optional[
|
appearance: Optional[
|
||||||
Union[
|
Union[
|
||||||
@ -412,7 +413,8 @@ class Theme(RadixThemesComponent):
|
|||||||
|
|
||||||
Args:
|
Args:
|
||||||
*children: Child components.
|
*children: Child components.
|
||||||
color_mode: map to appearance prop.
|
color_mode: Map to appearance prop.
|
||||||
|
theme_panel: Whether to include a panel for editing the theme.
|
||||||
has_background: Whether to apply the themes background color to the theme node. Defaults to True.
|
has_background: Whether to apply the themes background color to the theme node. Defaults to True.
|
||||||
appearance: Override light or dark mode theme: "inherit" | "light" | "dark". Defaults to "inherit".
|
appearance: Override light or dark mode theme: "inherit" | "light" | "dark". Defaults to "inherit".
|
||||||
accent_color: The color used for default buttons, typography, backgrounds, etc
|
accent_color: The color used for default buttons, typography, backgrounds, etc
|
||||||
|
Loading…
Reference in New Issue
Block a user