techniq / layerchart

Composable Svelte chart components to build a wide range of visualizations
https://www.layerchart.com
MIT License
668 stars 12 forks source link

[Tooltip] Improve structure and default styles #226

Closed techniq closed 2 months ago

techniq commented 4 months ago

Instead of

<Tooltip header={(data) => formatDate(data.date, "eee, MMMM do")} let:data>
  <TooltipItem label="value" value={data.value} />
</Tooltip>

a better structure

<Tooltip.Root let:data>
  <Tooltip.Header>{formatDate(data.date, "eee, MMMM do")}</Tooltip.Header>
  <Tooltip.List>
    <Tooltip.Item label="value" value={data.value} />
  </Tooltip.List>
</Tooltip.Root>

With this structure, TooltipHeader will need to use col-span-full since it will be within the default slots's grid

techniq commented 4 months ago

Reference for improved default styling

shadcn

image image

tremor

image image image image image

See also: