Replies: 5 comments 3 replies
-
Hi;
https://github.com/huntabyte/shadcn-svelte (https://www.shadcn-svelte.com/) comes to mind. A great example for your consideration in case it's ever decided. |
Beta Was this translation helpful? Give feedback.
-
Yea that's really neat. I like their interactive walkthrough. The idea has come up over the years and what's stopped me is the core idea of the library is that you have the freedom to make your own components. I didn't want people to feel like the components on the website were The Way To Make Charts™️ and I worry that making those components really easy to incorporate may not be the best option for new users. The counter-argument is: If you're going to make a bunch of components for the website that people can use as a jumping off point, why not make it as easy as possible for them to incorporate them into their projects? The line to balance is at what point does ease and convenience muddy the waters? I still get a lot of questions from confused people who don't realize that the components on the website are not a part of the library. (Even though I've written something to that effect on the home page, component gallery and at the top of the guide 😭. Maybe that copy is due for a rewrite since something about it is not clear enough!) Would having an official tool that incorporates those components into your project help someone understand what the library is meant to do or further confuse them? These components are also my own best crack at what a generic axis or bar chart component is – I wouldn't want people to think my choices are the absolute canon. I probably got some thing wrong or there are better patterns to use. For example, you could imagine some standard font-size CSS variable that you add via a prop in a lovely and elegant pattern. Instead, I've hard coded To summarize: I do like the idea of making it easier for people to download files. But I also think that the friction and atypical-ness of the current setup has some pedagogical value. Open to other thoughts, though! And, of course, anyone can build whatever they like! I think a CLI would most help power users who already understand the library. For them, I could see it being a really useful thing. |
Beta Was this translation helpful? Give feedback.
-
This might be a different use case than you're looking for but LayerChart is a library of pre-made viz built on top of Layer Cake. It provides some nice pre-made starter components but still adheres to the spirit of Layer Cake with composability. |
Beta Was this translation helpful? Give feedback.
-
Another idea that I've toyed with but I don't think I can take on as a maintainer would be a library that included Chart-level components with props for existing components like AxisX, Line etc. Something like: <script>
import { LayerCake, Svg } from 'layercake';
import { AreaChart } from 'layercake/charts';
import data from 'data.csv'
</script>
<LayerCake
x='myX'
y='myY'
{data}
>
<Svg>
<AreaChart/>
</Svg>
</LayerCake> The <script>
import AreaComponent from './Area.svelte';
import AxisXComponent from 'AxisX.svelte';
import AxisYComponent from 'AxisY.svelte';
export let AxisX = AxisXComponent;
export let AxisY = AxisYComponent;
export let Area = AreaComponent;
</script>
<svelte:component this={AxisX}/>
<svelte:component this={AxisY}/>
<svelte:component this={Area}/> What that would let you do is, without having to do the annoying step of copying any code into your project, you get a very quick chart setup while preserving the ability to override the default component with something from your project like this: <script>
import { LayerCake, Svg } from 'layercake';
import { AreaChart } from 'layercake/charts';
import MyAxisX from './custom-project-charts/MyAxisX.svelte';
import data from 'data.csv'
</script>
<LayerCake
x='myX'
y='myY'
{data}
>
<Svg>
<AreaChart
AxisX={MyAxisX}
/>
</Svg>
</LayerCake> If someone wanted to build this kind of library I think that would be really neat! My hesitations for doing it myself – and maybe I'll think differently in the future are:
But if anyone is so inspired, please take this idea and run with it! I think it provides definite speed and DX improvements without sacrificing customization. I don't really see a downside from the user's perspective. |
Beta Was this translation helpful? Give feedback.
-
Another idea how to facilitate re-using the components could be to expose the download path of individual files somehow on the Layer Cake website.
but could instead just be
A tool for this, like discussed above in the thread, is probably just a fancy wrapper around this approach. |
Beta Was this translation helpful? Give feedback.
-
I don't remember which UI component library was using such an approach but I was thinking it could be great to be able to download the Layer Cake components with some command line command into your own project instead of downloading a ZIP file or copying them from the website.
Have you thought about something like this?
Beta Was this translation helpful? Give feedback.
All reactions