Tronic247 Material
website·Indexed 30 days ago
https://material.pages.dev/A modern Material design framework featuring a comprehensive set of components including appbars, buttons, cards, dialogs, grids, and typography. The framework provides utilities for padding, margin, and elevation, as well as interactive elements like ripple effects, snackbars, and floating action buttons.
What's inside Tronic247 Material
- Tronic247 Material is a modern, lightweight Material Design framework designed to be user-friendly and dependency-free. It does not require external libraries such as jQuery; users can simply download the package and begin implementation.
Disable button interaction
To disable a button, add both thedisabledHTML attribute and thedisabledCSS class. This works across Normal, Outlined, and Text button styles.<button class="btn disabled" disabled>Disabled</button> <button class="btn outlined disabled" disabled>Disabled</button> <button class="btn text disabled" disabled>Disabled</button>Add a ripple effect to an element
To add a ripple effect to an element, apply theripple-eclass. Note that elements with the.btnclass already have this effect and do not require the additional class.<div class="ripple-e">Click Me</div>Implement a Modal Drawer using the Dialog API
To create a drawer that behaves as a modal, wrap the.drawercomponent inside a.dialogcontainer. Control the visibility of the modal drawer using theMaterial.Dialog.open()andMaterial.Dialog.close()methods. The JavaScript API for this implementation is identical to the Dialog API.<button id="aaa" class="btn">Toggle</button> <div class="dialog" id="a"> <div class="content p-0 drawer" style="height:max-content"> <div class="top ps-3"> <h2>Title</h2> <p>Lorem ipsum dolor sit amet co.</p> </div> <div class="content"> <div class="list"> <a href="#!" class="item">Item 1</a> <a href="#!" class="item active">Item 2</a> <a href="#!" class="item">Item 3</a> <a href="#!" class="item">Item 4</a> <a href="#!" class="item">Item 5</a> <a href="#!" class="item">Item 6</a> <a href="#!" class="item" id="aa">Close</a> </div> </div> </div> </div>let a = document.querySelector("#a"); let aaa = document.querySelector("#aaa"); let aa = document.querySelector("#aa"); // Open the modal drawer aaa.addEventListener("click", () => { Material.Dialog.open(a); }); // Close the modal drawer aa.addEventListener("click", () => { Material.Dialog.close(a); });Set up Material framework using local files
You can use a local copy of the framework by downloading the provided zip folder. The distribution contains a
dist/folder with compiled files and asrc/folder with source files.Important: The Roboto font and Material Design Icons are not included in the zip and must be imported manually from Google Fonts and the Material Design Icons website.
Position items in the Appbar
The Appbar supports three distinct placement areas for content:left,middle, andright. Use these classes within theappbarcontainer to distribute elements across the bar.<div class="appbar"> <div class="left"> <span class="title">Left</span> </div> <div class="middle"> <span class="title">Middle</span> </div> <div class="right"> <span class="title">Right</span> </div> </div>Install Material framework via CDN
To use the Material framework without a local installation, include the CSS and JavaScript files from the CDN. Note that Material Design icons must be linked separately.<!-- Material Design Icons --> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@mdi/font@6.5.95/css/materialdesignicons.min.css">
<!-- Material Framework CSS --> <link href="https://cdn.jsdelivr.net/gh/tronic247/material/dist/material.min.css" rel="stylesheet" />
<!-- Material Framework JS --> <script src="https://cdn.jsdelivr.net/gh/tronic247/material/dist/material.min.js"></script>
Initialize a Range Slider using Material.Forms
UseMaterial.Forms.initRangeSliderto initialize a range slider on a DOM element. The function accepts the target element and a configuration object defining the starting value and the range boundaries (min and max). The returned object provides access to the underlyingnoUiSliderinstance, allowing you to retrieve the current value using the.get()method.<!-- HTML element for the slider --> <input type="text" class="js-range-slider" name="my_range" value="" />// Initialize the range slider let range = Material.Forms.initRangeSlider(document.querySelector(".js-range-slider"), { start: 20, range: { min: 0, max: 100, }, }); // Retrieve the current value of the slider alert(range.noUiSlider.get());Customize the ripple effect color
Change the ripple color by adding color palette classes to the element, such ascolor-primary-5orcolor-secondary-2.<div class="ripple-e color-primary-5">Custom Color Ripple</div>Apply border rounding
Use rounding utility classes to apply border-radius to elements. Available options include standard rounding and larger presets.<div class="rounded">Standard rounded corners</div> <div class="rounded-xl">Extra large rounded corners</div> <div class="rounded-xll">Extra extra large rounded corners</div>Create a horizontal Card layout
To create a card with a side-by-side layout (image next to text), use the.cardcontainer and implement a grid system using.rowand.colclasses. This layout is suitable for profile cards or list items where the image is smaller and positioned to the left of the content.<div class="card" style="width:300px;"> <div class="row"> <div class="col"> <img src="https://via.placeholder.com/140x155"> </div> <div class="col pb-2"> <h3 class="display-h5">John Doe</h3> <p>Is a man who is popular</p> <button class="btn small unelevated"> Got it </button> </div> </div> </div>Add icons to a text input
Add icons to the start or end of a text field by placing icon elements (e.g., Material Design Icons) inside the.leftand.rightdivs of the.textboxcontainer.<div class="textbox"> <div class="left"> <i class="mdi mdi-heart"> </div <div class="middle"> <label for="a4" class="label">Label</label> <input type="text" id="a4" class="input"> </div <div class="right"> <i class="mdi mdi-heart"> </div </div