The shadcn-svelte based theme for svelte-jsonschema-form.
npm install @sjsf/form @sjsf/shadcn-theme
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";
<script lang="ts">
import { useForm } from '@sjsf/form';
import { theme, setThemeContext } from '@sjsf/shadcn-theme';
import { components } from '@sjsf/shadcn-theme/default'
const form = useForm({
...theme,
})
setThemeContext({ components })
</script>
MIT