@sjsf/shadcn-theme
v1.7.0
Published
The shadcn-svelte based theme for svelte-jsonschema-form
Downloads
229
Readme
@sjsf/shadcn-theme
The shadcn-svelte based theme for svelte-jsonschema-form.
Installation
npm install @sjsf/form @sjsf/shadcn-theme
Usage
Setup styles
There is two ways to setup styles:
- Use tailwindcss config
import { THEME_CONTENT } from '@sjsf/shadcn-theme/preset'
/** @type {import('tailwindcss').Config} */
export default {
content: ['./src/**/*.{html,js,svelte,ts}', THEME_CONTENT],
}
Or with a preset
import themePreset from '@sjsf/shadcn-theme/preset'
/** @type {import('tailwindcss').Config} */
export default {
presets: [themePreset],
}
- Inject prepared styles (not recommended)
// Inject them as you like
import themeStyles from "@sjsf/shadcn-theme/styles.css?inline";
Apply theme
<script lang="ts">
import { useForm2 } from '@sjsf/form';
import { theme, setThemeContext } from '@sjsf/shadcn-theme';
import { components } from '@sjsf/shadcn-theme/default'
const form = useForm2({
...theme,
})
setThemeContext({ components })
</script>
License
MIT