SVELTE-FLOW
Installation
Install SvelteKit and TailwindCSS:
npm init svelte@next sveltekit-demo
cd sveltekit-demo
npm install
npx svelte-add@latest tailwindcss
Install Flowbite:
npm i flowbite
Add the following to the __layout.svelte:
<script>
import "../app.css";
import "flowbite/dist/flowbite.css";
</script>
<div class="mx-auto p-2">
<slot />
</div>
In src/app.html
:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="description" content="" />
<link rel="icon" href="%svelte.assets%/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
%svelte.head%
</head>
<body>
<div id="svelte">%svelte.body%</div>
<script src="/node_modules/flowbite/dist/flowbite.js"></script>
</body>
</html>
Alert components
There are three components you can use: Alert
, BorderAlert
, and InfoAlert
.
All Alert components have three props: color
, alertId
, and closeBtn
.
let color = "blue";
let alertId = "alert-1";
let closeBtn = false;
Additionally InforAlert
has infoLink
prop:
let infoLink = false;
You can set a URL:
let infoLink = '/about'
Button component
let rounded = false;
let size = "sm";
let name = "Read more";
let type = "blue";
Card components
There are Card
, CtaCard
, EcommerceCard
, HorizontalCard
, InteractiveCard
, ListCard
, and SignInCard
compoents.
Card component
let link;
let img;
let btnName = "Read more";
let btnColor = "blue";
let header = 'Lorem ...'
Cta Card
let title = "Work fast from anywhere";
let content =
"Stay up to date and move work forward with Flowbite on iOS & Android. Download the app today.";
let btns = [
{
logo: "M318.7 268.7c-.2-36.7 16.4-64.4 50-84.8-18.8-26.9-47.2-41.7-84.7-44.6-35.5-2.8-74.3 20.7-88.5 20.7-15 0-49.4-19.7-76.4-19.7C63.3 141.2 4 184.8 4 273.5q0 39.3 14.4 81.2c12.8 36.7 59 126.7 107.2 125.2 25.2-.6 43-17.9 75.8-17.9 31.8 0 48.3 17.9 76.4 17.9 48.6-.7 90.4-82.5 102.6-119.3-65.2-30.7-61.7-90-61.7-91.9zm-56.6-164.2c27.3-32.4 24.8-61.9 24-72.5-24.1 1.4-52 16.4-67.9 34.9-17.5 19.8-27.8 44.3-25.6 71.9 26.1 2 49.9-11.4 69.5-34.3z",
title: "Download on the",
body: "Mac App Store",
link: "/#",
},
...
]
Ecommerce card
let img = {
src: "/images/product-1.png",
alt: "product image",
};
let link = "/#";
let btnColor = "blue";
let title = "Apple Watch Series ...";
let stars = "5.0";
let price
Horizontal card
let link;
let img;
let header
Interactive card
let dropdownLinks = [
{
href: "/",
name: "Name 1",
},
...
];
let img = {
src: "",
alt: "",
};
let header = "Lorem ipsum";
let content = "Proin efficitur purus felis.";
let btnColor1 = "blue";
let link1 = { href: "", title: "" };
let link2 = { href: "", title: "" };
List card
let lists = [
{
img: {
src: "/images/profile-picture-1.jpeg",
alt: "Neil Sims",
},
field1: "Neil Sims",
field2: "email@windster.com",
field3: "Advisor",
},
...
];
export let title = "Latest Customers";
export let action = {
link: "/#",
title: "View all",
};
SignIn card
let title = "Sign in";
let actionLink = "/sign-in";
let field1 = {
name: "email",
title: "Your email",
placeholder: "name@company.com",
required: "true",
};
let signupLink;
let lostPasswordLink;
List component
let lists = [
{
title: "Profile",
icon: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-6-3a2 2 0 11-4 0 2 2 0 014 0zm-2 4a5 5 0 00-4.546 2.916A5.986 5.986 0 0010 16a5.986 5.986 0 004.546-2.084A5 5 0 0010 11z",
link: "/profile",
external: false,
},
...
];
Modal components
ExtraLargeModal, LargeModal, MediumModal, ModalButton, SignInModal, SmallModal
To be finished
Navbar component
The default value for the active menu item is #ff0066
.
To overwrite the class active
for active menu item, add the following to src/app.css
:
#mobile-menu .active{
color: #36ec7c;
}
Props and their default values
- sitename:
sitename = "Svelte Flow"
. - logo:
logo = "/images/mkdir-logo.png"
- textsize:
textsize = "sm"
- menus:
let menus = [
{
name: "Home",
link: "/",
},
...
];
Tab components
There are three tab components: DefaultTabs, InteractiveTabs, and PillTabs.
DefaultTabs component
let tabs = [
{
name: "Profile",
active: true,
link: "/#",
},
...
];
InteractiveTabs
let tabId = "myTab";
let tabs = [
{
name: "Profile",
selected: true,
content:
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ",
},
...