How to get the props of a component to document them on a page? #13561
Answered
by
ryanatkn
JLAcostaEC
asked this question in
Q&A
-
I have searched for many options, however due to the poor support of svelte 5 this is difficult. What I am looking for is: Given the component: Button.svelte <script lang=ts>
export let {a, b,c}:
{
/** Example A prop */
a: string;
/** Example B prop */
b: string
c: string
} = $props()
</script>
<button> How can I extract those props as follows: DocsPage.svelte <script lang=ts>
import Button from "./button.svelte"
const extractedButtonProps = getButtonWithSomeLibOrFunction(Button)
</script>
{@render extractedButtonProps()} To finally get something like this: I have tried to use https://github.com/carbon-design-system/sveld/ however it is not supported and the project is not very active either Thanks in advance |
Beta Was this translation helpful? Give feedback.
Answered by
ryanatkn
Oct 13, 2024
Replies: 1 comment 1 reply
-
I made a quick attempt at this for Svelte 5: https://github.com/ryanatkn/svelte_docinfo_sketch You may also want to watch this Sveld issue. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
JLAcostaEC
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I made a quick attempt at this for Svelte 5: https://github.com/ryanatkn/svelte_docinfo_sketch
You may also want to watch this Sveld issue.