Here you'll learn how to use this framework.
Fluent Web Framework is still in development, but stable enough to be used.
Custom element "Border" with content.
<fluent-border>
<h3>Buton</h3>
<button>Fluent button</button>
</fluent-border>
Redesigned input checkbox.
<input type="checkbox" id="mycheck"><label for="mycheck">Am I a checkbox?</label>
Remade code element.
Fluent uses
Needs to be enabled first, see
Available languages:
CSS
.example-class {
margin: 2em;
}
Javascript
console.log("Hello world!");
Extension of the
Automatically creates a <code> element and a working example of what's in the template.
With the default settings, all code gets inserted directly after the <template> element
<template fluent-code="html">
<p>Hello, world!</p>
<fluent-label>This is a label</fluent-label>
</template>
Hello, world!
Code templates allow declaring the template somewhere and outputting the code and example somewhere else.
Simply specifiy a
You can also pass
Note that this replaces the specified element. For example, if you want to apply custom styling, you need to place it outside of the outlet.
<template fluent-code="html" outlet-id="outlet-code//outlet-example">
<h4>Hello, world!</h4>
<p>This is a This is a template</p>
</template>
<div id="outlet-code"></div>
<span style="color: pink">
<div id="outlet-example"></div>
</span>
This is a template
Element for displaying content in a dialog window.
Custom element which can be opened or closed.
Name | Preview | Usage | Description |
---|---|---|---|
| Recommended to use everytime. | ||
| Use only when user has to access this expander (e.g. Link that redirects to this expander). |
Element with text that shows on the top of the parent element.
Fluent_showFlyout(this, 'This is flyout', 2000);
Name | Type | Description |
---|---|---|
element | Element | Show flyout above this element. |
string | string | Text to show in flyout. |
delay | number | How long the flyout will be visible (in milliseconds). |
<button onclick="Fluent_showFlyout(this, 'This is flyout', 2000);">Show flyout!</button>
Element which can be put in text to redirect user to other page. Works the same like
Text in automatically adjusted background color and border.
Multiple styling attributes can be used on one label.
Attribute | Preview | Usage | Description |
---|---|---|---|
none |
| Standard label without styling attributes. | |
| Use any string color or a 6 digit long hex. | ||
| Label with Consolas font. Use consolas for code attributes or for tags. |
Custom element for switching between pages. Makes your webpage pages a lot easier.
Set active page index.
Fluent_setActivePageIndex('showcase-page-switcher', 0, true, "example/route-1");
Parameter | Type | Description |
---|---|---|
string | ID of the page switcher. | |
number | Page's index. | |
boolean | Use routing? See | |
string | Name of the route If unspecified, Fluent tries to choose a name for the route. |
<button onclick="Fluent_setActivePageIndex('showcase-page-switcher', 0)">Open Page 1</button>
<button onclick="Fluent_setActivePageIndex('showcase-page-switcher', 1)">Open Page 2</button>
<fluent-page-switcher id="showcase-page-switcher">
<fluent-page>
<h2>Page 1</h2>
</fluent-page>
<fluent-page>
<h2>Page 2</h2>
</fluent-page>
</fluent-page-switcher>
Redesigned input range.
Hover it to show menu.
<input type="range">
Redesigned
Tables are often used for showing some data.
Remember to use
<table>
<thead>
<tr>
<th>Header 1</th>
<th>Header 2</th>
<th>Header 3</th>
<th>Header 4</th>
</tr>
</thead>
<tbody>
<tr>
<td>Value</td>
<td>Value</td>
<td>Value</td>
<td>Value</td>
</tr>
<tr>
<td>Value</td>
<td>Value</td>
<td>Value</td>
<td>Value</td>
</tr>
</tbody>
</table>
Header 1 | Header 2 | Header 3 | Header 4 |
---|---|---|---|
Value | Value | Value | Value |
Value | Value | Value | Value |
Redesigned
Redesigned
Name | Preview | Usage | Description |
---|---|---|---|
none |
| Standard textbox. | |
| Textbox with button for clearing text. |
Redesigned
Name | Preview | Usage | Description |
---|---|---|---|
none |
| Standard passwordbox. | |
| Passwordbox with button for showing password. | ||
| Passwordbox with button for showing password with showed password on default. |
Container for webpage content.
Web container splits webpage into 2 columns.
<h1>My Webpage</h1>
<fluent-web-container>
<fluent-menu style="width: 15em;">
<fluent-menu-item selectable selected onclick="Fluent_setActivePageIndex('showcase-page-switcher-web-container', 0)">Page 1</fluent-menu-item>
<fluent-menu-item-expander header="More pages">
<fluent-menu-item selectable onclick="Fluent_setActivePageIndex('showcase-page-switcher-web-container', 1)">Page 2</fluent-menu-item>
<fluent-menu-item selectable onclick="Fluent_setActivePageIndex('showcase-page-switcher-web-container', 2)">Page 3</fluent-menu-item>
</fluent-menu-item-expander>
</fluent-menu>
<fluent-main-content>
<fluent-page-switcher id="showcase-page-switcher-web-container">
<fluent-page>
<h2>Page 1</h2>
</fluent-page>
<fluent-page>
<h2>Page 2</h2>
</fluent-page>
<fluent-page>
<h2>Page 3</h2>
</fluent-page>
</fluent-page-switcher>
</fluent-main-content>
</fluent-web-container>
Unlike in the original framework, you don't need to call any init functions.
You can use one of these functions to listen for Fluent being fully initialized
Fluent_onInitialized(() => {});
Fluent_onReady(() => {});
Enabled by default
Get Mica effect status
Fluent_isMicaActive();
Disable Mica effect
Fluent_disableMica();
Enable Mica effect
Fluent_enableMica();
Fluent has a light and a dark theme.
Fluent_themes
Get current theme:
Fluent_getActiveTheme();
Set a theme:
Fluent_setTheme(/*theme from Fluent_themes*/);
Switch the theme:
Fluent_switchTheme();
Listen for theme changes:
Fluent_onThemeChanged((newTheme) => { }, /*fire*/true);
If<script>
// Fluent Web Framework options
// Put this script before importing fluent.min.js
var FLUENT = {
noPrefix: false,
enableRouter: false,
enableCode: false,
enableIcons: false,
};
</script>
Option | Description | Type | Default |
---|---|---|---|
Compatibility with the original project Make functions and variables available without the `Fluent_` prefix and capitalizes the first letter. E.g. Fluent_showSplashScreen() becomes available as ShowSplashScreen(). | |||
Enable code highlighting Loads the code highlight module. | |||
Basic routing using hash location ( See Loads the router module. | |||
Enable icons Gets a list of ALL (at least 2) Fluent icons. (doesn't load the individual icons) See |
Fluent implements a basic hash location router, which can be enabled by setting
Using Fluent pages: (
Fluent_setActivePageIndex('page-switcher-id', 0, /*routing*/true, "example/route-1");
<fluent-page-switcher id="page-switcher" use-routing>
<fluent-page routing="optional-route-name">
...
</fluent-page>
</fluent-page-switcher>
If
Route handlers created by Fluent don't have params (yet).
Use
Manually navigate:
Fluent_routerNavigate("route");
Define a route:
Fluent_routerAddHandler("route", () => {
/* handler function */
});
Define multiple routes:
Fluent_routerAddHandlers({
"route1": () => { },
"route2": () => { },
});
Define a route with parameters:
Fluent_routerAddHandler("play/:id", (params) => {
/* params.id */
});
Fluent_routerAddHandler("play/?:id", (params) => {
/* params.id might be undefined */
});
Define a wildcard route:
Fluent_routerAddHandler("list/*", () => {
});
Fluent_routerAddHandler("*", () => {
/* custom handler function for all routes */
});
Fluent Router is based on Routie by jgallen23
Routie GitHubMost elements that have an
Using HTML:
<fluent-icon>icon_name</fluent-icon>
Get an icon as svg: (string)
await Fluent_getIcon("iconName"); // "<svg..."|null
Test if a string is a known icon:
Fluent_iconExists("iconName"); // true|false
List of all icons
Fluent_icons
There's currently 0 icons
Might take a long time
Originally created by Peter from BeXCool.
Ported to Typescript & Sass by spejik from BeXCool.
GitHub Web© BeXCool
Note that this page uses Microsoft Clarity (with cookies set to disabled) to help us catch any issues with components. See Microsoft Docs for more info.