Open other resource in new tab

is there any hooks or component to embed a text to open a new tab to another show resource
7 Replies
kapa.ai
kapa.ai12mo ago
Hi @ganuzaz. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Hmm, I don't know enough to give you a confident answer yet. The information extracts provided do not contain specific details about a hook or component for embedding a text to open a new tab to another show resource in refine. However, refine does provide various hooks and components for navigation and redirection, such as the ShowButton component and the useNavigation hook. You might be able to use these in combination with other React techniques to achieve your goal. For more information, you can refer to the refine documentation on ShowButton (https://refine.dev/docs/api-reference/components/buttons/show-button) and useNavigation (https://refine.dev/docs/api-reference/core/hooks/navigation/useNavigation/). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai12mo ago
<@149140198213550080> kapa.ai is still learning and improving, please let us know how it did by reacting below
fascinating-indigo
fascinating-indigo12mo ago
can useNavigation be used to open the resource in a new tab @kapa.ai can useNavigation be used to open the resource in a new tab
kapa.ai
kapa.ai12mo ago
Let me check the knowledge base for you. One moment! :books: ---------------------- The useNavigation hook in refine provides methods for navigating within the app, but it does not directly support opening a resource in a new tab. This hook is designed for programmatic navigation within the same tab. Here's an example of how you might use useNavigation:
import { useNavigation } from "@refinedev/core";

const {
list,
create,
edit,
show,
clone,
push,
replace,
goBack,
listUrl,
createUrl,
editUrl,
showUrl,
cloneUrl,
} = useNavigation();
import { useNavigation } from "@refinedev/core";

const {
list,
create,
edit,
show,
clone,
push,
replace,
goBack,
listUrl,
createUrl,
editUrl,
showUrl,
cloneUrl,
} = useNavigation();
(Source: refine.dev (https://refine.dev/docs/api-reference/core/hooks/navigation/useNavigation)) To open a resource in a new tab, you would typically use the standard HTML <a> tag with the target="_blank" attribute. You can use the URL-generating methods from useNavigation (like showUrl, createUrl, etc.) to generate the URL for the resource you want to open. However, please note that useNavigation is a legacy hook and not recommended to use even though it is still available and not deprecated. It's recommended to use your router libraries' hooks and methods instead of this when dealing with custom navigations. Refine now exports useGo, useParsed, useBack, useLink and useGetToPath hooks for the new routing system. (Source: refine.dev (https://refine.dev/docs/api-reference/core/hooks/navigation/useNavigation)) ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai12mo ago
<@149140198213550080> kapa.ai is still learning and improving, please let us know how it did by reacting below
other-emerald
other-emerald12mo ago
Hello @ganuzaz , you can get listUrl with navigation and you can use regular <a> element or showUrl ofc
fascinating-indigo
fascinating-indigo12mo ago
yes, thanks!