### Install and Run DocPad
Source: https://github.com/semantic-org/semantic-ui-docs/blob/master/README.md
Installs the necessary Node.js version, DocPad globally, and then installs project dependencies and starts the development server.
```bash
nvm install 8
nvm use 8
npm install -g docpad@6.79.4
docpad install;
docpad run
```
--------------------------------
### Semantic UI Progress Component Examples
Source: https://github.com/semantic-org/semantic-ui-docs/blob/master/server/partials/examples/progress.html
This snippet demonstrates various ways to initialize and control the Semantic UI progress component. It includes examples for basic progress, progress with custom text, file upload progress, and dynamic updates.
```javascript
$(document) .ready(function() {
$('.attached.progress.demo')
.progress({
label : false,
value : Math.floor(Math.random() * 5) + 1
});
$('.basic.progress.demo')
.progress({
label : false,
value : Math.floor(Math.random() * 5) + 1,
text : {
active : '{percent}% Complete',
success : 'Done!'
}
});
$('.indicating.progress.demo')
.progress({
label : true,
total : 10,
value : Math.floor(Math.random() * 5) + 1,
text : {
active : '{percent}% Done',
success : 'Completed!'
}
});
$('.file.progress.demo')
.progress({
label: false,
text: {
active : 'Uploading {value} of {total}',
success : '{total} Files Uploaded!'
}
});
var progress = function() {
$('.demo.progress').progress('increment');
setTimeout(progress, (Math.random() * 2000) + 300);
};
setTimeout(progress, 1000);
setInterval(function() {
$('.demo.progress').progress('reset');
}, 30000);
});
```
--------------------------------
### Semantic UI Grid Simple Examples
Source: https://github.com/semantic-org/semantic-ui-docs/blob/master/server/partials/examples/grid.html
Presents simple grid examples in Semantic UI. This styling ensures basic column separation with a minimum height for columns that are not rows or nested grids.
```css
.demo .grid.simple.examples .grid .column:not(.row):not(.grid):after { content: ""; display: block; min-height: 50px; }
```
--------------------------------
### Selection Dropdown Example
Source: https://github.com/semantic-org/semantic-ui-docs/blob/master/server/partials/examples/form.html
Demonstrates the basic structure and usage of a selection dropdown component in Semantic UI.
```html
Select
Choice 1
Choice 2
```
--------------------------------
### Input Fields and Labels
Source: https://github.com/semantic-org/semantic-ui-docs/blob/master/server/partials/examples/form.html
Shows examples of various input fields including required, disabled, and password inputs, along with their associated labels.
```html
```
--------------------------------
### Semantic UI Button State Management
Source: https://github.com/semantic-org/semantic-ui-docs/blob/master/server/partials/examples/button.html
Demonstrates how to manage the state of a follow button using Semantic UI's state module. This includes setting initial text and updating it based on user interaction.
```javascript
$('.button.demo .follow') .state({
text: {
inactive : 'Follow',
active : 'Following'
}
});
```
--------------------------------
### Semantic UI Grid Shaded Examples
Source: https://github.com/semantic-org/semantic-ui-docs/blob/master/server/partials/examples/grid.html
Demonstrates shaded grid examples in Semantic UI. It styles rows and columns to have a shaded appearance, with pseudo-elements used for visual separation.
```css
.demo .grid.shaded.examples .row { position: relative; }
.demo .grid.shaded.examples .grid > .column { position: relative; z-index: 11; }
.demo .grid.shaded.examples .grid .column:not(.row):after { background-color: #AAAAAA; content: ""; display: block; min-height: 1em; }
```
--------------------------------
### Initialize Accordion
Source: https://github.com/semantic-org/semantic-ui-docs/blob/master/server/partials/examples/accordion.html
Initializes the accordion component on elements with the class 'ui accordion' within elements having the class 'example' inside 'demo' containers. This is a common pattern for applying Semantic UI components.
```javascript
$(document) .ready(function(){ $('.demo .example .ui.accordion') .accordion() ; }) ;
```
--------------------------------
### Semantic UI Grid Divided Examples
Source: https://github.com/semantic-org/semantic-ui-docs/blob/master/server/partials/examples/grid.html
Shows divided grid examples in Semantic UI. This styling adds a visual divider between columns using pseudo-elements with a semi-transparent background color.
```css
.demo .grid.divided.examples .grid .column:not(.row):after { background-color: rgba(0, 0, 0, 0.1); content: ""; display: block; min-height: 1em; }
```
--------------------------------
### Informational Message Example
Source: https://github.com/semantic-org/semantic-ui-docs/blob/master/server/partials/examples/message.html
Displays an informational message, typically used for providing context or guidance to the user. It uses the 'info' color scheme.
```html
Info Message
Example description
```
--------------------------------
### Semantic UI Grid Nested Examples
Source: https://github.com/semantic-org/semantic-ui-docs/blob/master/server/partials/examples/grid.html
Illustrates nested grid examples in Semantic UI. This styling applies a subtle border to inner grids and uses pseudo-elements for column separation within nested structures.
```css
.demo .grid.nested.examples .grid .grid { box-shadow: 0px 0px 0px 1px #F0F0F0 inset; }
.demo .grid.nested.examples .grid .grid .column:after { background-color: #AAAAAA; content: ""; display: block; min-height: 1em; }
```
--------------------------------
### Initialize Default Rating
Source: https://github.com/semantic-org/semantic-ui-docs/blob/master/server/partials/examples/rating.html
Initializes the Semantic UI Rating component with its default settings. This is typically used for basic star rating functionality.
```javascript
$(document) \
.ready(function() { \
$('.rating.demos .items .ui.rating') \
.rating() \
; \
})
```
--------------------------------
### Warning Message Example
Source: https://github.com/semantic-org/semantic-ui-docs/blob/master/server/partials/examples/message.html
Displays a warning message, alerting the user to potential issues or important considerations. It uses the 'warning' color scheme.
```html
Warning Message
List item
List item
```
--------------------------------
### List Message Example
Source: https://github.com/semantic-org/semantic-ui-docs/blob/master/server/partials/examples/message.html
Shows a message component containing an unordered list. This is useful for displaying multiple related items or points within a message.
```html
List Message
List item 1
List item 2
List item 3
```
--------------------------------
### HTML Structure for Popups
Source: https://github.com/semantic-org/semantic-ui-docs/blob/master/server/partials/examples/popup.html
Provides the HTML structure for various popup examples, including basic popups, small and large variations, and inverted popups. This serves as the content that the JavaScript popup component will attach to.
```html
Browse
```
--------------------------------
### Attached Message Example
Source: https://github.com/semantic-org/semantic-ui-docs/blob/master/server/partials/examples/message.html
Illustrates how messages can be attached to the top or bottom of other elements, creating a contiguous visual block.
```html
Top attached
Content segment
Bottom attached
```
--------------------------------
### Semantic UI Grid Animation Styling
Source: https://github.com/semantic-org/semantic-ui-docs/blob/master/server/partials/examples/grid.html
Applies animation-related styling to Semantic UI grid examples. It resets margins and paddings for the grid container to ensure smooth animations.
```css
.demo .grid.examples { margin: 0em !important; padding: 0em !important; }
```
--------------------------------
### Closable Message Example
Source: https://github.com/semantic-org/semantic-ui-docs/blob/master/server/partials/examples/message.html
Demonstrates a closable message component in Semantic UI. When the close icon is clicked, the message animates out using a 'scale out' transition.
```javascript
$(document) .ready(function(){ $(".example .message .close") .on("click", function() { $(this).closest(".message").transition("scale out"); }) ; }) ;
```
```html
This is a closable message.
```
--------------------------------
### Negative Message Example
Source: https://github.com/semantic-org/semantic-ui-docs/blob/master/server/partials/examples/message.html
Indicates an error or negative outcome. It uses the 'negative' color scheme, typically associated with red.
```html
Negative Message
Example description
```
--------------------------------
### Positive Message Example
Source: https://github.com/semantic-org/semantic-ui-docs/blob/master/server/partials/examples/message.html
Represents a positive outcome or success message. It uses the 'positive' color scheme, often associated with green.
```html
Positive Message
Example description
```
--------------------------------
### Multiple Inline Fields Example
Source: https://github.com/semantic-org/semantic-ui-docs/blob/master/server/partials/examples/form.html
Shows how to arrange multiple input fields horizontally using inline styling.
```html
```
--------------------------------
### Wireframe Image Placeholder
Source: https://github.com/semantic-org/semantic-ui-docs/blob/master/server/partials/examples/feed.html
Represents a placeholder for an image within a wireframe layout. This is a common UI element used during the design phase.
```html
```
--------------------------------
### Initialize Clearable Rating
Source: https://github.com/semantic-org/semantic-ui-docs/blob/master/server/partials/examples/rating.html
Initializes the Semantic UI Rating component with the 'clearable' option enabled, allowing users to reset their rating selection.
```javascript
$(document) \
.ready(function() { \
$('.rating.demos .list .ui.rating') \
.rating({ clearable: true }) \
; \
})
```
--------------------------------
### Semantic UI Shape Animation Control
Source: https://github.com/semantic-org/semantic-ui-docs/blob/master/server/partials/examples/shape.html
This JavaScript code snippet demonstrates how to initialize and control Semantic UI's shape component. It includes event handling for buttons that trigger different rotation animations and directions on the shape. The code relies on jQuery and Semantic UI libraries.
```javascript
$(document) .ready(function() {
var $demo = $('.shape.demos .ui.shape'),
$directionButton = $('.shape.demos .direction .button'),
handler ;
// event handlers
handler = {
rotate: function() {
var $shape = $(this).closest('.buttons').prevAll('.ui.shape').eq(0),
direction = $(this).data('direction') || false,
animation = $(this).data('animation') || false;
if(direction && animation) {
$shape.shape(animation + '.' + direction);
}
}
};
// attach events
$demo.shape();
$directionButton.on('click', handler.rotate).popup({
position : 'bottom center'
});
});
```
--------------------------------
### Generate and Serve Semantic UI Docs
Source: https://github.com/semantic-org/semantic-ui-docs/blob/master/README.md
Steps to generate Semantic UI documentation by building the UI and then running the DocPad server. It also includes an option to watch for UI changes.
```bash
# Clone both repos to respective folders
# npm install in both directories
# Go through Semantic UI installer steps (auto)
# In ./ui folder `gulp build-docs` (builds files to ./docs)
# In ./docs folder `docpad install` then `docpad run`
# Go to http://localhost:9778/ docs should be there
# Optionally run `gulp serve-docs` in ./ui to serve any changes from ./ui/src to ./docs
```
--------------------------------
### Publish to GitHub Pages
Source: https://github.com/semantic-org/semantic-ui-docs/blob/master/README.md
Command to automatically deploy the generated documentation to GitHub Pages.
```bash
docpad deploy-ghpages --env static
```
--------------------------------
### Technology Stack
Source: https://github.com/semantic-org/semantic-ui-docs/blob/master/server/raw/humans.txt
Lists the core technologies used in the project, including markup, styling, and scripting languages.
```text
HTML5, CSS3
jQuery
```
--------------------------------
### Semantic UI Initialization
Source: https://github.com/semantic-org/semantic-ui-docs/blob/master/server/partials/examples/card.html
Initializes Semantic UI components such as ratings and dimmers on document ready. It targets elements with specific classes to apply interactive behaviors.
```javascript
$(document) .ready(function(){
$('.demo .star.rating') .rating() ;
$('.demo .card .dimmer') .dimmer({
on: 'hover'
}) ;
});
```
--------------------------------
### Semantic UI Modal Initialization and Event Handling
Source: https://github.com/semantic-org/semantic-ui-docs/blob/master/server/partials/examples/modal.html
This JavaScript code demonstrates how to initialize and manage Semantic UI modals. It shows how to attach modals to specific buttons for triggering, including standard, basic, and full-screen modal types. It relies on jQuery and Semantic UI's modal module.
```javascript
$(document) \
.ready(function() { \
$('.demo.modal') \
.modal() \
; \
$('.standard.demo.modal') \
.modal('attach events', '.standard.demo.button') \
; \
$('.basic.demo.modal') \
.modal('attach events', '.minimal.demo.button') \
; \
$('.fullscreen.demo.modal') \
.modal('attach events', '.fullscreen.demo.button') \
; \
})
```
--------------------------------
### Semantic UI Transition Animations
Source: https://github.com/semantic-org/semantic-ui-docs/blob/master/server/partials/examples/transition.html
This code demonstrates how to apply various CSS transition animations from Semantic UI to an element when a button is clicked. It listens for clicks on buttons within a '.transition.demo' container and applies the corresponding animation to elements with the class '.transition.demo .image'.
```javascript
$(document) \
.ready(function(){ \
$('.transition.demo .button') \
.on('click', function() { \
var animation = $(this).text(); \
if(typeof animation == 'string') { \
animation = animation.toLowerCase(); \
} \
$('.transition.demo .image') \
.transition({ animation: animation, interval: 200 }) \
; \
}) \
; \
}) \
;
```
```css
.transition.demo .button { margin-bottom: 0.5em; } \
/* Dont hide on hide */ \
.transition.demo .ui.hidden.image { display: inline-block !important; }
```
--------------------------------
### Toggle and Option Fields
Source: https://github.com/semantic-org/semantic-ui-docs/blob/master/server/partials/examples/form.html
Demonstrates the implementation of toggle switches and grouped option fields.
```html
```
--------------------------------
### Basic Popup Initialization
Source: https://github.com/semantic-org/semantic-ui-docs/blob/master/server/partials/examples/popup.html
Initializes the popup component on elements with the class 'popup'. This is the most basic usage, applying default popup behavior.
```javascript
$(document).ready(function() {
$('.popup.demos .position .icon').popup();
$('.popup.demos .avatar').popup();
$('.popup.demos .button').popup();
});
```
--------------------------------
### Advanced Popup Configuration
Source: https://github.com/semantic-org/semantic-ui-docs/blob/master/server/partials/examples/popup.html
Demonstrates an advanced popup configuration with specific settings for inline display, hoverable behavior, positioning, and show/hide delays. This is useful for creating more interactive and customized tooltips.
```javascript
$(document).ready(function() {
$('.popup.demos .menu .browse').popup({
inline: true,
hoverable: true,
position: 'bottom left',
delay: {
show: 300,
hide: 800
}
});
});
```
--------------------------------
### Form with Messages
Source: https://github.com/semantic-org/semantic-ui-docs/blob/master/server/partials/examples/form.html
Shows how to structure a form with submit buttons and display warning or error messages with descriptions.
```html
```
--------------------------------
### Semantic UI Tab Initialization
Source: https://github.com/semantic-org/semantic-ui-docs/blob/master/server/partials/examples/tab.html
Initializes Semantic UI tabs with history and context support. This is useful for creating navigable tabbed interfaces.
```javascript
$(document) .ready(function(){
$('.tab.demo .menu .item')
.tab({
history: true,
context: $('.tab.demo')
})
;
});
```
--------------------------------
### Initialize Semantic UI Checkboxes
Source: https://github.com/semantic-org/semantic-ui-docs/blob/master/server/partials/examples/checkbox.html
Initializes all elements with the class 'ui.checkbox' within the '.demo' container using Semantic UI's checkbox behavior. This is a common pattern for activating interactive elements on a page.
```javascript
$(document) .ready(function(){ $('.demo .ui.checkbox') .checkbox() ; }) ;
```
--------------------------------
### Checkbox and Inline Fields
Source: https://github.com/semantic-org/semantic-ui-docs/blob/master/server/partials/examples/form.html
Demonstrates the usage of a checkbox and how to arrange multiple input fields inline.
```html
```
--------------------------------
### Dropdown and Menu Initialization
Source: https://github.com/semantic-org/semantic-ui-docs/blob/master/server/partials/examples/dropdown.html
Initializes Semantic UI dropdowns and hoverable menus using jQuery. This code targets elements with specific classes to enable their interactive behavior.
```javascript
$(document) .ready(function(){
$('.demo .ui.dropdown')
.dropdown()
;
$('.demo .ui.menu .dropdown')
.dropdown({
on: 'hover'
})
;
})
```
--------------------------------
### Semantic UI Dropdown Initialization
Source: https://github.com/semantic-org/semantic-ui-docs/blob/master/server/documents/hotfix.html
Initializes a Semantic UI dropdown component with hover activation, clearable option, and a drop transition. This code requires the Semantic UI JavaScript library.
```javascript
$(document).ready(function() {
$('.ui.dropdown').dropdown({
transition: 'drop',
on: 'hover',
clearable: true
});
});
```
--------------------------------
### Semantic UI Search with Local Data
Source: https://github.com/semantic-org/semantic-ui-docs/blob/master/server/partials/examples/search.html
Initializes the Semantic UI search component using a predefined local array of content objects. This is suitable for smaller datasets or when data is readily available client-side.
```javascript
var content = [ { title: 'French Territories' }, { title: 'Togs' }, { title: 'Thailans' }, { title: 'Tajikistas' }, { title: 'Tokelas' }, { title: 'Timorlests' }, { title: 'Turkmenistas' }, { title: 'Tunisis' }, { title: 'Tongs' }, { title: 'Turkes' }, { title: 'Trinidas' }, { title: 'Tuvals' }, { title: 'Taiwas' }, { title: 'Tanzanis' }, { title: 'Ukrains' }, { title: 'Ugands' }, { title: 'Us Minor Islands' }, { title: 'United States' }, { title: 'Uruguas' }, { title: 'Uzbekistas' }, { title: 'Vatican Cits' }, { title: 'Saint Vincens' }, { title: 'Venezuels' }, { title: 'British Virgin Islands' }, { title: 'Us Virgin Islands' }, { title: 'Vietnas' }, { title: 'Vanuats' }, { title: 'Wallis and Futuns' }, { title: 'Samos' }, { title: 'Yemes' }, { title: 'Mayotts' }, { title: 'South Africs' }, { title: 'Zambis' }, { title: 'Zimbabws' } ];
$('.search.demo .local').search({
source: content
});
```
--------------------------------
### Semantic UI Dimmable Section Initialization
Source: https://github.com/semantic-org/semantic-ui-docs/blob/master/server/partials/examples/dimmer.html
Initializes the Semantic UI dimmer component on a page dimmer element. This sets up the basic functionality for dimming the entire page.
```javascript
$(document).ready(function() {
// selector cache
var $pageDimmer = $('.demo.page.dimmer');
// Initializes the dimmer on the page dimmer element
$pageDimmer.dimmer();
});
```
--------------------------------
### Radio Button Selection
Source: https://github.com/semantic-org/semantic-ui-docs/blob/master/server/partials/examples/form.html
Illustrates how to implement radio button groups for single selection from multiple options, including inline variations.
```html