(Easy - Fast - Lightweight)
Tonada is a free toolkit build with 💖 focus on performance ,
ease, lightweight and seo friendly
To make the web development more interesting and easiest 🙌.
Tonada is a free toolkit build with 💖 focus on performance ,
ease, lightweight and seo friendly
To make the web development more interesting and easiest 🙌.
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tonada@latest/dist/css/index.css"/>
<script src="https://cdn.jsdelivr.net/npm/tonada@latest/dist/js/index.js"></script>
npm i tonada
On of our library advance is about if you need to send the data directly by submitting the forms without
using ajax
so you don't need to write more javascript code to handle this and collect the data just
submit your form and see the magic happen 💨 than can be good for PHP developers and building the static web
pages much faster
To apply your first tonada element and let's select the Input then copy this HTML
<div id="element">
<input class="tonada-input" type="text" name="email" placeholder="Email">
</div>
Then call Tonada
to do the work on this element.
<script src="../dist/js/index.js"></script>
<script>
Tonada.create('input', document.getElementById('element'));
</script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tonada@latest/dist/css/input.css"/>
Input group:
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tonada@latest/dist/css/input-group.css"/>
Input password:
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tonada@latest/dist/css/input-password.css"/>
<div id="element" class="floating-label">
<input class="tonada-input" type="text" name="floating-name" placeholder="Name">
<label for="">Name</label>
</div>
<script src="../dist/js/index.js"></script>
<script>
Tonada.create('input', document.getElementById('element'));
</script>
<div id="element">
<span>$</span>
<div class="floating-label">
<input class="tonada-input" type="text" name="name" placeholder="Name" />
<label for="">Name</label>
</div>
<span>.00</span>
</div>
<script>
Tonada.create('input-group', document.getElementById('element'));
</script>
<div id="element">
<span>$</span>
<input class="tonada-input" type="text" name="name" placeholder="Name">
<span>.00</span>
</div>
<script>
Tonada.create('input-group', document.getElementById('element'));
</script>
apply the error state by add tonada-invalid
class on
the input container
and use tonada-errors
class on the list.
<div id="element" class="floating-label tonada-invalid">
<input class="tonada-input" type="text" name="name" placeholder="Name" />
<label for="">Name</label>
</div>
<ul class="tonada-errors">
<li>Name is required</li>
....
</ul>
<div id="element">
<input
type="password"
class="tonada-input"
name="password"
placeholder="password"
/>
<label for="">Password</label>
<i class="tonada-password-toggle tonada-ic tonada-ic-show"></i>
</div>
<script>
Tonada.create('input-password', document.getElementById('element'));
</script>
<div id="element" class="floating-label">
<input
type="password"
class="tonada-input"
name="password"
placeholder="password"
/>
<label for="">Password</label>
<i class="tonada-password-toggle tonada-ic tonada-ic-show"></i>
</div>
<script>
Tonada.create('input-password', document.getElementById('element'));
</script>
The classes sizes Tonada support are
tonada-sm
tonada-lg
tonada-xl
<div id="element" class="floating-label tonada-sm">
<input class="tonada-input" type="text" name="name" placeholder="Name" />
<label for="">Name</label>
</div>
<script>
Tonada.create('input', document.getElementById('element'));
</script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tonada@latest/dist/css/select.css"/>
Options:
<div id="element">
<select>
<option value="1">Option 1</option>
<option selected value="2">Option 2</option>
<option value="3">Option 3</option>
</select>
</div>
<script>
Tonada.create('select', document.getElementById('#element'));
</script>
<div id="element">
<select multiple="multiple">
<option value="1">Option 1</option>
<option selected value="2">Option 2</option>
....
</select>
</div>
<script>
Tonada.create("select", document.querySelector("#element"));
</script>
<div id="element">
<select disabled>
<option value="1">Option 1</option>
<option selected value="2">Option 2</option>
<option value="3">Option 3</option>
</select>
</div>
<script>
Tonada.create('select', document.querySelector('#element'));
</script>
Api:
Name | Description | Type |
---|---|---|
multiple | enable select many options | number |
disabled | disabled or enable select | boolean |
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tonada@latest/dist/css/slider.css"/>
<div id="element" >
<ul class="tonada-list">
<li class="tonada-list-item">1</li>
<li class="tonada-list-item">2</li>
....
</ul>
<button class="tonada-slider-button tonada-prev">
<i class="tonada-ic tonada-ic-arrow-left"></i>
</button>
<button class="tonada-slider-button tonada-next">
<i class="tonada-ic tonada-ic-arrow-right"></i>
</button>
<div class="tonada-slider-paginator"></div>
</div>
<script>
Tonada.create("slider", document.getElementById("element"), {
itemsPerPage: 4,
slideAnimation: "moving",
});
</script>
<div id="element">
<ul class="tonada-list">
<li class="tonada-list-item">1</li>
<li class="tonada-list-item">2</li>
<li class="tonada-list-item">3</li>
<li class="tonada-list-item">4</li>
<li class="tonada-list-item">5</li>
</ul>
<button class="tonada-slider-button tonada-prev">
<i class="tonada-ic tonada-ic-arrow-left"></i>
</button>
<button class="tonada-slider-button tonada-next">
<i class="tonada-ic tonada-ic-arrow-right"></i>
</button>
<div class="tonada-slider-paginator"></div>
</div>
<script>
Tonada.create('slider', document.getElementById('element'), {
slideAnimation: 'fading',
autoSliding: true
})
</script>
Api:
Name | Description | Type |
---|---|---|
itemsPerPage | number of items per page. | number |
slideAnimation | how the slider going to slide between pages" | "moving" or "fading" |
autoSliding | Enable auto sliding. | boolean |
autoSlidingDuration | The duration for sliding between items only works with slideAnimation=fading ⛔. | number |
paginator | Show or hide the pages buttons. | boolean |
navigators | Show or hide the next and previous buttons. | boolean |
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tonada@latest/dist/css/checkbox.css"/>
Checkbox Group:
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tonada@latest/dist/css/checbox-group.css"/>
A dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.
A dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.
<div id="element" class="tonada-accordion">
<div class="tonada-accordion-section">
<div class="tonada-accordion-header">
....
</div>
<div class="tonada-accordion-content">
....
</div>
</div>
</div>
<script>
Tonada.create('accordion', document.getElementById('element'));
</script>
You can have many accordion inside each others by add the accordion html and don't forget to add the accordion
class tonada-accordion
A dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.
A dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.
A dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.
A dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.
<div id="element" class="tonada-accordion">
<div class="tonada-accordion-section">
<div class="tonada-accordion-header">
....
</div>
<div class="tonada-accordion-content">
<div class="tonada-accordion">
<div class="tonada-accordion-section">
<div class="tonada-accordion-header">
....
</div>
<div class="tonada-accordion-content">
....
</div>
</div>
</div>
</div>
</div>
</div>
<script>
Tonada.create('accordion', document.getElementById('element'));
</script>
Api:
Name | Description | Type |
---|---|---|
open | open the accordion | function(void) |
close | close the accordion | function(void) |
toggle | toggle the accordion | function(void) |
// Default variable overrides
$tn-font-size: 16px;
$tn-border-radius: 8px;
// Required
@import "../node_modules/tonada/src/scss/variables";
@import "../node_modules/tonada/src/scss/mixins";
@import "../node_modules/tonada/src/scss/root";
// Optional
@import "../node_modules/tonada/src/scss/input";
@import "../node_modules/tonada/src/scss/slider";
// ...
Tonada
┣ 📂src
┃ ┣ 📂scss
┃ ┃ ┃ ┣ 📜index.scss # It import all the component or you can import only your needs
┃ ┃ ┃ ┣ 📜accordion.scss
┃ ┃ ┃ ┣ 📜button.scss
┃ ┃ ┃ ┣ 📜checkbox-group.scss
┃ ┃ ┃ ┣ 📜checkbox.scss
┃ ┃ ┃ ┗ 📜input-group.scss
┃ ┃ ┃ ┗ 📜input-group.scss
...
css
root variables or write our classes and you should do that after importing the
styles files
<link rel="stylesheet" href="../dist/css/button.css" />
<link rel="stylesheet" href="../dist/css/icons.css" />
<link rel="stylesheet" href="../dist/css/input.css" />
<style>
:root {
--tonada-color-primary: #1c3879;
--tonada-color-secondary: #607eaa;
--tonada-color-success: #30dd78;
--tonada-color-danger: #ff004c;
--tonada-color-white: #ffffff;
/* etc */
}
.tonada-checkbox {
/* etc */
}
</style>
Tonada
┣ 📂dist
┃ ┣ 📂css
┃ ┃ ┃ ┣ 📜index.css # Import this or only the components you need
┃ ┃ ┃ ┣ 📜accordion.css
┃ ┃ ┃ ┣ 📜button.css
┃ ┃ ┃ ┣ 📜checkbox-group.css
┃ ┃ ┃ ┣ 📜checkbox.css
┃ ┃ ┃ ┗ 📜input-group.css
...