-
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.
feat: API Reference Components (#24)
- Loading branch information
Showing
49 changed files
with
847 additions
and
195 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,5 @@ | ||
--- | ||
"@svecodocs/kit": patch | ||
--- | ||
|
||
feat: add `PropField`, `Collapsible`, and `Select` components |
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
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
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
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
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,49 @@ | ||
--- | ||
title: Collapsible | ||
description: Show and hide content in a collapsible container. | ||
section: Components | ||
--- | ||
|
||
<script> | ||
import { Collapsible, DemoContainer, PropField } from "@svecodocs/kit"; | ||
</script> | ||
|
||
## Usage | ||
|
||
```svelte title="document.md" | ||
<script> | ||
import { Collapsible, DemoContainer } from "@svecodocs/kit"; | ||
</script> | ||
<Collapsible title="more info"> | ||
<!-- space here so MD can render --> | ||
To learn more about SvelteKit, check out the [SvelteKit documentation](https://svelte.dev/kit). | ||
<!-- space here so MD can render --> | ||
</Collapsible> | ||
``` | ||
|
||
## Example | ||
|
||
<Collapsible title="more info" class="mt-6"> | ||
|
||
To learn more about SvelteKit, check out the [SvelteKit documentation](https://svelte.dev/kit). | ||
|
||
</Collapsible> | ||
|
||
## Props | ||
|
||
<PropField name="title" type="string"> | ||
The title to display in the trigger. "Hide" and "Show" prefix will be added automatically. | ||
</PropField> | ||
|
||
<PropField name="open" type="boolean" defaultValue="false"> | ||
Whether the content should be open or closed. | ||
</PropField> | ||
|
||
<PropField name="triggerContent" type="Snippet"> | ||
Override the content inside of the trigger button. | ||
</PropField> | ||
|
||
<PropField name="children" type="Snippet"> | ||
The content that is collapsible. | ||
</PropField> |
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
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
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,93 @@ | ||
--- | ||
title: PropField | ||
description: Display a prop field with a name, type, and description. | ||
section: Components | ||
--- | ||
|
||
<script> | ||
import { PropField, Collapsible } from "@svecodocs/kit"; | ||
</script> | ||
|
||
Use the `PropField` component to annotate props/params in your documentation. | ||
|
||
## Usage | ||
|
||
```svelte title="document.md" | ||
<script> | ||
import { PropField } from "@svecodocs/kit"; | ||
</script> | ||
<PropField name="checked" type="boolean" required defaultValue="false"> | ||
<!-- Space here--> | ||
The checked state of the checkbox. | ||
<!-- Space here--> | ||
</PropField> | ||
``` | ||
|
||
## Examples | ||
|
||
### Basic | ||
|
||
<PropField name="checked" type="boolean" defaultValue="false" required> | ||
The checked state of the checkbox. | ||
</PropField> | ||
|
||
### Object | ||
|
||
You can use `PropField` in combination with the [`Collapsible`](/docs/components/collapsible) component to represent more complex types. | ||
|
||
```svelte title="document.md" | ||
<script> | ||
import { PropField, Collapsible } from "@svecodocs/kit"; | ||
</script> | ||
<PropField name="options" type="CheckboxOptions" required> | ||
<!-- Space here --> | ||
Configuration options to customize the behavior of the `Checkbox` component. | ||
<!-- Space here --> | ||
<Collapsible title="properties"> | ||
<PropField name="width" type="number" required> | ||
The width to apply to the checkbox. | ||
</PropField> | ||
<PropField name="height" type="number" required defaultValue="20"> | ||
The height to apply to the checkbox. | ||
</PropField> | ||
</Collapsible> | ||
</PropField> | ||
``` | ||
|
||
<PropField name="options" type="CheckboxOptions" required> | ||
|
||
Configuration options to customize the behavior of the `Checkbox` component. | ||
|
||
<Collapsible title="properties"> | ||
<PropField name="width" type="number" required> | ||
The width to apply to the checkbox. | ||
</PropField> | ||
<PropField name="height" type="number" required defaultValue="20"> | ||
The height to apply to the checkbox. | ||
</PropField> | ||
</Collapsible> | ||
</PropField> | ||
|
||
## Props | ||
|
||
<PropField name="name" type="string" required> | ||
The name of the prop. | ||
</PropField> | ||
|
||
<PropField name="type" type="string" required> | ||
The type of the prop. | ||
</PropField> | ||
|
||
<PropField name="defaultValue" type="string"> | ||
The default value of the prop. | ||
</PropField> | ||
|
||
<PropField name="required" type="boolean" defaultValue="false"> | ||
Whether the prop is required. | ||
</PropField> | ||
|
||
<PropField name="children" type="Snippet"> | ||
The description/content to display within the prop field. | ||
</PropField> |
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,32 @@ | ||
--- | ||
title: Select | ||
description: A select component to use in examples and documentation. | ||
section: Components | ||
--- | ||
|
||
<script> | ||
import { Select, DemoContainer } from "@svecodocs/kit"; | ||
import SelectDemo from "$lib/components/demos/select-demo.svelte"; | ||
</script> | ||
|
||
## Usage | ||
|
||
```svelte title="document.md" | ||
<script> | ||
import { Select } from "@svecodocs/kit"; | ||
</script> | ||
<Select> | ||
<!-- ... --> | ||
</Select> | ||
``` | ||
|
||
## Example | ||
|
||
<DemoContainer class="flex items-center gap-2.5 flex-wrap"> | ||
<SelectDemo /> | ||
</DemoContainer> | ||
|
||
## Props | ||
|
||
See [Bits UI Select](https://bits-ui.com/docs/components/select) for available props. |
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
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
Oops, something went wrong.