Replies: 1 comment 1 reply
-
One question this raises is how do you handle props to these components? Once you're adding a custom component, is there anything better than doing something like: <Svg>
<AreaChart
AxisX={CoolAxisX}
AxisXProps={{
gridlines: false,
ticks: [0, 1, 2, 3, 4]
}}
/>
</Svg> and then in the <svelte:component this={AxisX} ...AxisXProps/> Disconnecting |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Based on this comment, here's an idea for how to use Layer Cake as a source of shared chart resources in your organization in a way that preserves the ability to customize as needed.
Step 1
Create a repository of Layer Cake components, similar to what's on the website, but in your own house style and with whatever customizations / props you want
Step 2
Build chart-level components out of these so that your users don't need to import individual
Line.svelte
orAxisX.svelte
components. Instead they can importLineChart.svelte
orAreaChart.svelte
and get up and running quickly.But, and here's the key, allow these chart-level components to replace their internally referenced components with components provided by props like so:
That will let your users start off quickly preserving the ability to override the default component with something custom for this project.
Putting it all together
Let's say you want to replace the built-in AxisX component with your own, simply import that component from your local project and pass it into the
<AreaChart>
component:Beta Was this translation helpful? Give feedback.
All reactions