Move Chevron Icon to the Right in SidebarNavigationDisclosure #4247
Replies: 3 comments
-
Disclaimer: This is a very experimental bot using OpenAI's GPT-4. The answers may not be correct, a human will review the answer and update it if necessary. Sorry, I don't know how to help with that. I did do a search though, and I managed to find these other Discussions that might be similar or related to your question. Give them a read to see if they answer your question. If they do, head back here and update this discussion and mark it as answered, pointing others to the related discussion:
|
Beta Was this translation helpful? Give feedback.
-
The Here's a recommended approach:
Here's an example implementation: import { useSidebarNavigationDisclosureState } from '@twilio-paste/core/sidebar';
import { ChevronDisclosureIcon } from '@twilio-paste/icons/esm/ChevronDisclosureIcon';
const SidebarNavigationDisclosureExample = () => {
const disclosure = useSidebarNavigationDisclosureState();
return (
<SidebarNavigationDisclosure state={disclosure}>
<SidebarNavigationDisclosureHeadingWrapper>
<Box display="flex" justifyContent="space-between" alignItems="center">
<SidebarNavigationDisclosureHeading icon={<ProductContactCenterTeamsIcon decorative />} selected>
Drivers
</SidebarNavigationDisclosureHeading>
<Box
as="span"
display="flex"
color="colorTextIconInverse"
height="sizeIcon20"
width="sizeIcon20"
transition="transform 150ms ease"
transform={disclosure.visible ? 'rotate(90deg)' : 'rotate(0deg)'}
onClick={disclosure.toggle}
>
<ChevronDisclosureIcon color="inherit" decorative size="sizeIcon20" />
</Box>
</Box>
</SidebarNavigationDisclosureHeadingWrapper>
<SidebarNavigationDisclosureContent>
<SidebarNavigationItem
href="/drivers/applications"
selected={window.location.pathname === '/drivers/applications'}
>
Driver Applications
</SidebarNavigationItem>
</SidebarNavigationDisclosureContent>
</SidebarNavigationDisclosure>
);
}; This approach uses the To continue talking to Dosu, mention @dosu. Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other |
Beta Was this translation helpful? Give feedback.
-
Hi @Clinton-dev 👋 this is not currently supported for the component. Is this a product of Twilio? You can achieve something similar though by using our CustomizationProvider to target the specific header elements. Here is a CodeSandbox for how this works and code snippet below. The issue with this is it would also change the decorative icon and text positions. If you removed icons you could get it to look good if you added <CustomizationProvider
elements={{
SIDEBAR_NAVIGATION_DISCLOSURE_HEADING: {
direction: "rtl",
},
}}
> |
Beta Was this translation helpful? Give feedback.
-
Hello,
I'm working with the
SidebarNavigationDisclosure
component in Twilio Paste and would like to move the chevron icon from the left side to the right side of the disclosure heading.By default, the chevron appears on the left side, but for my design, I need it to be positioned on the right side.
Screenshot:
Current Code:
What I Tried:
I attempted to manually place the chevron on the right side using
Box
andChevronDownIcon
, but I encountered the following issues:Attempted Code:
Question:
Is there a built-in way in
SidebarNavigationDisclosure
to position the chevron on the right while retaining its default animation, color, and functionality?Or is there a recommended approach to achieve this?
Any guidance would be greatly appreciated. Thanks!
Beta Was this translation helpful? Give feedback.
All reactions