1.0.0-alpha.20 • Published 6 months ago

@svelte-fui/core v1.0.0-alpha.20

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

@svelte-fui/core

Contains all the necessary UI component of the Fluent Design System (Still under development)

Usage

Add @fluentui/react-components to a project:

// pnpm
pnpm install @svelte-fui/core

//npm
npm install @svelte-fui/core

To use Fluent design for Sveltekit app you have to make App component at the top level route, ex: /routes/+layout.svelte

<script>
	import { App, Button } from '@svelte-fui/core';
	
	// This is ude in tailwindcss project or you can ignore and use your tailwindcss setup stylesheet, it should work fine
	import '@svelte-fui/core/styles/root';

	// Uncomment the file import if you want to use the library outside a tailwindcss project
	//import '@svelte-fui/core/styles/compiled';
</script>

<App>
	<Button>Hello World!</Button>
</App>

Using FUI preset fot TailwindCSS

This will allow you to integrate FUI tokens into your TailwindCSS config.

// pnpm
pnpm install @svelte-fui/tailwindcss

//npm
npm install @svelte-fui/tailwindcss
// tailwindcss.config.js

import { fuiPreset } from '@svelte-fui/tailwindcss';

/** @type {import('tailwindcss').Config} */
export default {
	presets: [fuiPreset],
	content: ['./src/**/*.{html,js,svelte, stories.svelte, ts}']
};

Now in your .svelte file you can use FUI tokens as tw classes:

<!-- src/routes/+page.svelte -->
<script>
  // some logic goes here
</script>

<!--  -->

<div class="bg-neutral-background-1 text-neutral-foreground-1 font-base-400">
    <!-- UI contents goes here -->
</div>

Use Pre-Defined Themes

// pnpm
pnpm install @svelte-fui/themes

//npm
npm install @svelte-fui/themes
<script>
  import { webLightTheme, webDarkTheme } from '@svelte-fui/themes';
  import { App, Button } from '@svelte-fui/core';

	let theme = webLightTheme;

	onMount(() => {
		function handler(schemeMedia) {
			theme = schemeMedia.matches ? webLightTheme : webDarkTheme;
		}

		const schemeMedia = matchMedia('(prefers-color-scheme: light)');

		schemeMedia.addEventListener('change', handler);

		theme = schemeMedia.matches ? webLightTheme : webDarkTheme;

		return () => {
			schemeMedia.removeEventListener('change', handler);
		};
	});
</script>

<App {theme}>
	<Button>Fluent UI for Svelte</Button>
</App>
1.0.0-alpha.19

7 months ago

1.0.0-alpha.16

7 months ago

1.0.0-alpha.15

7 months ago

1.0.0-alpha.18

7 months ago

1.0.0-alpha.17

7 months ago

1.0.0-alpha.14

7 months ago

1.0.0-alpha.20

6 months ago

1.0.0-alpha.9

9 months ago

1.0.0-alpha.8

9 months ago

1.0.0-alpha.7

9 months ago

1.0.0-alpha.6

9 months ago

1.0.0-alpha.10

9 months ago

1.0.0-alpha.5

9 months ago

1.0.0-alpha.4

9 months ago

1.0.0-alpha.2

9 months ago

1.0.0-alpha.12

9 months ago

1.0.0-alpha.11

9 months ago

1.0.0-alpha.13

9 months ago

1.0.0-alpha.1

1 year ago

0.2.0

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.9

2 years ago

0.1.6

2 years ago

0.1.4

2 years ago

0.1.5

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago