13 Apr 2023 04:38 PM - last edited on 30 May 2023 11:25 AM by MaciejNeumann
Hi,
I wanted to navigate to the next page via a button. It will be via the onSelect method.
How should I exactly implement it specifically the navigation via all the buttons including return?
<TitleBar.Suffix>
<ButtonWrapper>
<Button prefixIcon={<HomeIcon />} variant="minimal" >
Home
</Button>
<Button prefixIcon={<DataTableIcon />} variant="minimal">
Software
</Button>
<Button prefixIcon={<StackedBarChartIcon />} variant="minimal">
Analytics
</Button>
</ButtonWrapper>
</TitleBar.Suffix>
Solved! Go to Solution.
13 Jun 2023 08:00 AM - edited 13 Jun 2023 08:18 AM
Hi @kwangxi 👋
Sorry for the late reply, and maybe you've already solved this.
If not, I'll give you a few options. The most straightforward solution is to create a function to override location, and pass it as event handler on the button component:
const clickHandler = () => {
location.href = "https://google.com"
};
...
<Button onClick="clickHandler()">
Click Me
</Button>
The best practice for this however, is to either use a component which allows for this in it's interface, or a router. For the former, the Strato design system has the <Link /> component you can use. For the latter, you can use React Router, which is also included when you bootstrap your app with dt-app.