-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
99 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
## Svelte 5 usage (experimental) | ||
|
||
> [!WARNING] | ||
> This component is based on the release candidate of Svelte 5 and is considered | ||
> unstable. Any breaking changes will not be properly indicated in | ||
> `svelte-cartesian` releases at this time, but there are no planned changes. | ||
1. Install package | ||
|
||
```bash | ||
npm install -D svelte-cartesian | ||
``` | ||
|
||
2. Add component to your page. | ||
|
||
```html | ||
<script> | ||
import Button from "./Button.svelte" | ||
import { CartesianWithRunes as Cartesian } from "svelte-cartesian" | ||
</script> | ||
|
||
{#snippet children()} Click me {/snippet} <Cartesian Component={Button} | ||
props={{ variant: ['primary', 'secondary'], size: ['medium', 'large'], | ||
children: [children] }} /> | ||
``` | ||
|
||
3. Pass props with array of potential values, including an explicit `undefined` | ||
where applicable. Ensure snippets are passed in as props and defined within | ||
the markup of the page using `<CartesianWithRunes>`. | ||
|
||
### Styling `<CartesianWithRunes>` | ||
|
||
Styling `<CartesianWithRunes>` is done in the exact same way as with [`<Cartesian>`](./README.md#styling-cartesian). | ||
|
||
### `<CartesianWithRunes>` props | ||
|
||
| prop | type | description | | ||
| --------------- | ------------------------------- | ------------------------------------------------------------------------------- | | ||
| `Component` | `ComponentType` | **Required**: A Svelte component. | | ||
| `props` | `Record<string, any[]>` | **Required**: An object containing prop names and an array of potential values. | | ||
| `unstyled` | `?boolean=false` | Disable built-in CSS. | | ||
| `divAttributes` | `?SvelteHTMLElements["div"]={}` | Attributes to be spread onto the wrapping `<div>` element. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters