0.4.2 • Published 4 months ago

epfn-svelte-components v0.4.2

Weekly downloads
-
License
-
Repository
github
Last release
4 months ago

EPFN Components for Svelte

Opinionated Svelte components for my personal purposes.

Installation

npm i epfn-svelte-components

Import component

<script>
	import { Drawer } from 'epfn-svelte-components';
</script>

Drawer

Headless-like side appearing drawer with backdrop. You must provide content (with styles) via default slot.

Button position is controlled by putting Drawer Component anywhere you like. Drawer position is controlled via placement prop.

Store

You can import drawerState store which contain close and toggle methods.

<script>
	import { drawerState } from 'epfn-svelte-components';
</script>

Props

propdescriptiontypedefault value
widthwidth of Drawer in pxnumber260
placementposition of Drawer"left" | "right""left"
durationduration of Drawer animation in msnumber150

Slots

slotdescription
defaultcontent inside drawer

Styling

CSS variabledescriptionfallback value
--drawer-backdrop-colorcolor of backdroprgba(0, 0, 0, 0.75)
--drawer-close-button-colorcolor of SVG icon (X)black
--drawer-open-button-colorcolor of SVG icon (Hamburger)black

Menu

List of links.

Props

propdescriptiontypedefault value
linksarray of links{ href: string; label: string; active?: boolean }[]
typestyle of menu"header" | "drawer"
on:clickon:click event forwarded to link

Styling

CSS variabledescriptionfallback value
--menu-border-colorcolor of border between list itemsgray
--menu-border-widththickness of underline2px

Spinner

Usual animated spinner

Styling

CSS variabledescriptionfallback value
--spinner-colorcolor of spinnerwhite

Alerts

Vertical list of animated alerts

Props

propdescriptiontypedefault value
itemsarray of alerts{ text: string; type: 'success' | 'error' | 'warning' }[]
durationduration of alert animation in msnumber200
themecolor theme, 'both' includes both light and dark themes'both' | 'light' | 'dark''both'

FieldText, FieldEmail, FieldPassword, FieldSearch, FieldTextarea, FieldCheckbox

Inputs with label

propdescriptiontypedefault value
valuevalue for input bindingstring""
labeltext for labelstring
nametext for input name attributestring
placeholdertext for input placeholder attributestring""
requiredvalue for input required attributebooleanfalse
readonlyvalue for input readonly attributebooleanfalse
errorvalue for input aria-invalid attributebooleanfalse
hiddenif true checkbox is hiddenbooleanfalse
rowsvalue for textarea rows attributenumber8
themecolor theme, 'both' includes both light and dark themes'both' | 'light' | 'dark''both'
accentcolor for border and outline on hover or focus'bw' | 'gray' | 'blue' | 'pink''bw'
0.4.2

4 months ago

0.4.1

5 months ago

0.4.0

5 months ago

0.3.0

1 year ago

0.3.1

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.1.0

1 year ago