--- layout: default title: Components Guide nav_order: 4 --- # Components Guide {: .no_toc } Complete reference for all components available in Gentelella Admin Template {: .fs-6 .fw-300 } ## Table of contents {: .no_toc .text-delta } 1. TOC {:toc} --- ## Dashboard Components ### Dashboard Layouts Gentelella includes three pre-designed dashboard layouts: #### Main Dashboard (`index.html`) - **Revenue widgets** with animated counters - **Real-time charts** showing trends and analytics - **Activity timeline** with user interactions - **Quick stats** cards with icons - **To-do lists** with progress tracking ```html

Total Revenue

73

$52,147

``` #### Dashboard 2 (`index2.html`) - **Full-width charts** for detailed analytics - **Map integration** with geographical data - **Compact widgets** for KPIs - **News feed** with updates #### Dashboard 3 (`index3.html`) - **Calendar integration** with events - **Weather widget** with forecasts - **Social media stats** counters - **Project timeline** view ### Widget Cards #### Tile Widgets ```html
Total Users
2500
4% From last Week
``` #### Info Box Widgets ```html

Network Activities

United States 2,371
``` --- ## Chart Components ### Chart.js Integration #### Line Charts ```javascript // Initialize line chart import Chart from 'chart.js/auto'; const ctx = document.getElementById('lineChart').getContext('2d'); const lineChart = new Chart(ctx, { type: 'line', data: { labels: ['January', 'February', 'March', 'April', 'May', 'June'], datasets: [{ label: 'Sales', data: [12, 19, 3, 5, 2, 3], borderColor: '#73879C', backgroundColor: 'rgba(115, 135, 156, 0.1)', tension: 0.4 }] }, options: { responsive: true, plugins: { legend: { position: 'bottom' } } } }); ``` #### Bar Charts ```html

Monthly Sales

``` #### Pie Charts ```javascript const pieChart = new Chart(ctx, { type: 'pie', data: { labels: ['Desktop', 'Mobile', 'Tablet'], datasets: [{ data: [300, 50, 100], backgroundColor: ['#73879C', '#26B99A', '#3498DB'] }] } }); ``` ### Morris.js Charts #### Line Charts ```javascript Morris.Line({ element: 'line-chart', data: [ { y: '2023-01', a: 100, b: 90 }, { y: '2023-02', a: 75, b: 65 }, { y: '2023-03', a: 50, b: 40 } ], xkey: 'y', ykeys: ['a', 'b'], labels: ['Series A', 'Series B'] }); ``` #### Area Charts ```javascript Morris.Area({ element: 'area-chart', data: [ { period: '2023-01', sales: 2666, downloads: 2647 }, { period: '2023-02', sales: 2778, downloads: 2294 } ], xkey: 'period', ykeys: ['sales', 'downloads'], labels: ['Sales', 'Downloads'] }); ``` ### Sparkline Charts ```javascript $('.sparkline').sparkline([5,6,7,2,0,-4,-2,4], { type: 'line', width: '100%', height: '30', lineColor: '#26B99A', fillColor: 'rgba(38, 185, 154, 0.3)' }); ``` ### Gauge Charts ```javascript import Gauge from 'gauge.js'; const gauge = new Gauge(document.getElementById('gauge')).setOptions({ angle: 0.15, lineWidth: 0.2, radiusScale: 1, pointer: { length: 0.6, strokeWidth: 0.035, color: '#000000' }, limitMax: false, limitMin: false, colorStart: '#6FADCF', colorStop: '#8FC0DA', strokeColor: '#E0E0E0', generateGradient: true, highDpiSupport: true }); gauge.maxValue = 100; gauge.setMinValue(0); gauge.animationSpeed = 32; gauge.set(67); ``` --- ## Form Components ### Basic Form Elements #### Input Fields ```html
``` #### Select Dropdowns ```html
``` ### Advanced Form Components #### Select2 Enhanced Dropdowns ```html ``` ```javascript // Initialize Select2 $('.select2').select2({ theme: 'bootstrap-5', width: '100%', placeholder: 'Select options...' }); ``` #### Date/Time Pickers ```html
``` ```javascript import { DateTime } from 'tempus-dominus'; new DateTime(document.getElementById('reservation'), { display: { components: { calendar: true, date: true, month: true, year: true, decades: true, clock: false } } }); ``` #### Range Sliders ```html
``` ```javascript $("#range-slider").ionRangeSlider({ type: "double", min: 0, max: 1000, from: 200, to: 500, prefix: "$" }); ``` #### File Upload with Dropzone ```html

Drop files here or click to upload

``` ```javascript import Dropzone from 'dropzone'; new Dropzone("#file-dropzone", { url: "/upload", maxFilesize: 10, acceptedFiles: ".jpeg,.jpg,.png,.gif" }); ``` #### Rich Text Editor ```html

Initial content...

``` ### Form Validation #### Bootstrap Validation ```html
Please provide a valid first name.
``` #### Parsley.js Validation ```html
``` --- ## Table Components ### Basic Tables #### Responsive Table ```html
Name Position Office Salary
Tiger Nixon System Architect Edinburgh $320,800
``` ### DataTables Integration #### Basic DataTable ```html
Name Position Office Age Start date Salary
``` ```javascript $('#datatable').DataTable({ ajax: '/api/employees', columns: [ { data: 'name' }, { data: 'position' }, { data: 'office' }, { data: 'age' }, { data: 'start_date' }, { data: 'salary' } ], responsive: true, pageLength: 25, dom: 'Bfrtip', buttons: ['copy', 'csv', 'excel', 'pdf', 'print'] }); ``` #### Advanced DataTable Features ```javascript $('#advanced-datatable').DataTable({ processing: true, serverSide: true, ajax: { url: '/api/data', type: 'POST' }, columns: [ { data: 'id', searchable: false }, { data: 'name' }, { data: 'email' }, { data: 'actions', orderable: false, searchable: false, render: function(data, type, row) { return ` `; } } ], order: [[0, 'desc']], pageLength: 50, lengthMenu: [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]] }); ``` --- ## UI Elements ### Navigation Components #### Sidebar Navigation ```html
``` #### Breadcrumbs ```html

Form Elements

``` ### Modal Components #### Basic Modal ```html ``` #### Large Modal with Form ```html ``` ### Alert Components #### Bootstrap Alerts ```html
Success! This is a success alert.
Error! Something went wrong.
``` #### PNotify Notifications ```javascript import PNotify from 'pnotify'; // Success notification new PNotify({ title: 'Success!', text: 'Your changes have been saved.', type: 'success', styling: 'bootstrap4' }); // Error notification new PNotify({ title: 'Error!', text: 'An error occurred while processing your request.', type: 'error', styling: 'bootstrap4' }); ``` ### Progress Components #### Progress Bars ```html
40% Complete (success)
75%
``` #### Animated Progress with JavaScript ```javascript function animateProgress(selector, targetPercentage) { const progressBar = document.querySelector(selector); let currentPercentage = 0; const interval = setInterval(() => { if (currentPercentage >= targetPercentage) { clearInterval(interval); return; } currentPercentage++; progressBar.style.width = currentPercentage + '%'; progressBar.textContent = currentPercentage + '%'; }, 20); } // Usage animateProgress('.progress-bar', 85); ``` --- ## Map Components ### jVectorMap Integration #### World Map ```html
``` ```javascript $('#world-map').vectorMap({ map: 'world_mill', backgroundColor: 'transparent', regionStyle: { initial: { fill: '#73879C', "fill-opacity": 1, stroke: '#fff', "stroke-width": 1, "stroke-opacity": 1 } }, series: { regions: [{ values: { "US": 298, "SA": 200, "AU": 760, "IN": 2000000, "GB": 120 }, scale: ['#26B99A', '#E74C3C'], normalizeFunction: 'polynomial' }] } }); ``` #### Regional Map ```javascript $('#usa-map').vectorMap({ map: 'us_aea', backgroundColor: 'transparent', regionsSelectable: true, series: { regions: [{ values: { "US-CA": 200, "US-TX": 300, "US-NY": 250 }, scale: ['#3498DB', '#E74C3C'] }] } }); ``` --- ## Calendar Components ### FullCalendar Integration ```html
``` ```javascript import { Calendar } from '@fullcalendar/core'; import dayGridPlugin from '@fullcalendar/daygrid'; import timeGridPlugin from '@fullcalendar/timegrid'; import interactionPlugin from '@fullcalendar/interaction'; const calendarEl = document.getElementById('calendar'); const calendar = new Calendar(calendarEl, { plugins: [dayGridPlugin, timeGridPlugin, interactionPlugin], headerToolbar: { left: 'prev,next today', center: 'title', right: 'dayGridMonth,timeGridWeek,timeGridDay' }, initialDate: new Date(), navLinks: true, selectable: true, selectMirror: true, select: function(arg) { const title = prompt('Event Title:'); if (title) { calendar.addEvent({ title: title, start: arg.start, end: arg.end, allDay: arg.allDay }); } calendar.unselect(); }, eventClick: function(arg) { if (confirm('Are you sure you want to delete this event?')) { arg.event.remove(); } }, editable: true, dayMaxEvents: true, events: [ { title: 'All Day Event', start: '2023-01-01' }, { title: 'Long Event', start: '2023-01-07', end: '2023-01-10' } ] }); calendar.render(); ``` --- ## Media Components ### Image Gallery ```html
``` ```javascript $('.fancybox').fancybox({ openEffect: 'elastic', closeEffect: 'elastic', helpers: { title: { type: 'inside' } } }); ``` --- ## Next Steps - **[Customization Guide]({{ site.baseurl }}/docs/customization/)** - Learn how to customize these components - **[Performance Guide]({{ site.baseurl }}/docs/performance/)** - Optimize component loading - **[API Reference]({{ site.baseurl }}/docs/api/)** - Detailed API documentation - **[Examples]({{ site.baseurl }}/docs/examples/)** - See components in action --- {: .highlight } 💡 **Pro Tip**: Use the smart loading system to load only the components you need on each page. This significantly improves performance while maintaining functionality.