Accordion Root Exclude color_scheme
and variant
props in tag (#2664)
* Accordion Root Exclude `color_scheme` and `variant` props in tag * colorScheme -> color for radix primitives * remove _rename_props based on pr comments * lint * pyi fix * pop instead of del
This commit is contained in:
parent
6384c62e51
commit
eeff4142ab
@ -502,6 +502,14 @@ class Component(BaseComponent, ABC):
|
||||
if isinstance(child, Component):
|
||||
child.apply_theme(theme)
|
||||
|
||||
def _exclude_props(self) -> list[str]:
|
||||
"""Props to exclude when adding the component props to the Tag.
|
||||
|
||||
Returns:
|
||||
A list of component props to exclude.
|
||||
"""
|
||||
return []
|
||||
|
||||
def _render(self, props: dict[str, Any] | None = None) -> Tag:
|
||||
"""Define how to render the component in React.
|
||||
|
||||
@ -544,6 +552,10 @@ class Component(BaseComponent, ABC):
|
||||
props.update(self._get_style())
|
||||
props.update(self.custom_attrs)
|
||||
|
||||
# remove excluded props from prop dict before adding to tag.
|
||||
for prop_to_exclude in self._exclude_props():
|
||||
props.pop(prop_to_exclude, None)
|
||||
|
||||
return tag.add_props(**props)
|
||||
|
||||
@classmethod
|
||||
|
@ -463,6 +463,9 @@ to {
|
||||
`
|
||||
"""
|
||||
|
||||
def _exclude_props(self) -> list[str]:
|
||||
return ["color_scheme", "variant"]
|
||||
|
||||
|
||||
class AccordionItem(AccordionComponent):
|
||||
"""An accordion component."""
|
||||
|
Loading…
Reference in New Issue
Block a user