{{ @props.small }}
{{/if}}Fez brings a familiar component-based approach you know from Vue or React, but strips away the build complexity. It lets you write components naturally, right in your HTML, without needing a compilation step. Think of it as a jQuery for modern component development, with the simplicity of dropping a script tag into your page. You get to use your components as if they were native HTML elements, making the development experience straightforward and intuitive.
<ui-clock>
, place them anywhere in your HTML, and they just work. (Try it now in dev tools - instant magic!)use
/bind
and Vue-like :attribute
bindings.connect
, onMount
, beforeRender
, and onPropsChange
for precise and predictable control.With reactive state and custom style.
That is it! Edit this demo on JSbin
You will learn all Fez features, just by inspecting these examples. You can edit and update both HTML and Fez code.
{{#block ...}}
this.fezHide()
will remove fez node from dom, and set this.root
to first parent node and return initial child nodes.Click to flip!
Click to flip!
Click to flip!
Click to see
this.state
object triggers re-render.onDestroy() { ... }
- execute code when component is removed from DOMsetInterval() { ... }
to set interval on a instance. No need to clear it, it will be auto cleared on component destroy.Fez.head(...)
that will safely insert script tags in the page headerFez.untilTrue(...)
that will execute code every 100 miliseconds until it returns true
this.formData()
. Get form data as object.this.onSubmit()
. If present, auto bind form and get form data as object:
if you want to calculate attribute value. Same as in Vue, current example :ping="..."
FORM
instead of default DIV
:
(in this example :size=
this.find()
to find node in template, shortcut for this.root.querySelector()
this.beforeRender()
to prepare vars before render (clean alternative to svelte $: {...}
this.onResize()
to execute code on window resized. Auto cleared when node is removed.
⇧
|
|
⇧
|
First tab
second tab
second tab
this.childNodes()
FEZ instance helper function, get all first level child nodes, excluding #text nodes.:fez { ... }
is present, anything inside is local, anythig outside is global.
If no class :fez
is present, style is considered local.
Param city: {{ @props.city }}
Time now:
Random num: {{ Math.random() }}
⋅fez-bind
- two way binding of input elementfez-use
- when node is added to dom, call described function and pass node as reference (inspired by Svelte)No tasks found
{{/if}} {{#for task, index in @state.tasks}} {{#if task.animate}}{{/if}} ⋅ ⋅
{{/for}}⋅
{{ JSON.stringify(this.state.tasks, null, 2) }}
If you want to preserve state in templates, wrap content in "fez-slot"
Refresh: {{Math.random()}}
Do not refresh: {{Math.random()}}.
Fez was created by @dux in 2024.