### Basic Column Layout Example (HTML) Source: https://usetrmnl.com/framework/columns Demonstrates a basic column layout using the Columns system. This allows for flexible content distribution across multiple columns, suitable for organizing plugin content. ```html
{{ Content for column 1 }}
{{ Content for column 2 }}
{{ Content for column 3 }}
``` -------------------------------- ### Bit-Depth Responsive Example (HTML) Source: https://usetrmnl.com/framework/responsive Shows how to apply styles based on display bit-depth. Each variant targets a specific bit-depth (1bit, 2bit, 4bit) for color capabilities. ```html
``` -------------------------------- ### Value System: XXSmall Text Size with Tabular Numbers (HTML) Source: https://usetrmnl.com/framework/value Demonstrates how to apply the XXSmall text size variant for the Value system. Includes an example with tabular numbers for precise alignment of numerical data. ```html Example 48,206.62 ``` -------------------------------- ### Device-Specific Display Control Examples Source: https://usetrmnl.com/framework/visibility Demonstrates combining size and bit-depth prefixes for precise targeting of specific devices and display capabilities. This allows for optimized layouts across TRMNL's diverse hardware. ```html
Simple layouts for lower bit-depth displays
``` -------------------------------- ### HTML for Regular Scale Screen (100%) Source: https://usetrmnl.com/framework/scale This HTML example represents the 'Regular' scale level (100%) of the Usetrmnl framework. This is the default scale, serving as the baseline for all other scale adjustments. The 'screen--scale-regular' class is applied to the container. ```html
``` -------------------------------- ### HTML: Value Component Size Variants Source: https://usetrmnl.com/framework/value Demonstrates how to apply different size classes to the Value component for various text display needs, from body text to prominent headings. Includes examples for .value--small, .value--large, .value--xlarge, .value--xxlarge, and .value--xxxlarge. ```html Example 48,206.62 Example 48,206.62 Example 48,206.62 Example 48,206.62 Example 48,206.62 Example 48,206.62 ``` -------------------------------- ### HTML: Inline Flex Container Example Source: https://usetrmnl.com/framework/flex This snippet demonstrates how to create an inline-level flex container using the `inline-flex` CSS display property. It shows how text can precede and follow the flex container, with the container itself aligning with the text line. No external JavaScript dependencies are required. ```html Text before
Text after ``` -------------------------------- ### HTML Text Fitting Example Source: https://usetrmnl.com/framework/fit_value Demonstrates how to use the 'data-value-fit' and 'data-value-fit-max-height' attributes to enable text fitting. This ensures text content remains within specified height constraints by automatically adjusting font size and weight. ```html Hello. This is a really long headline that will need to adjust significantly to fit within its container space and look good in a layout. This is a medium length headline that fits nicely. Hello. ``` -------------------------------- ### Richtext Component: Center Alignment Example (HTML) Source: https://usetrmnl.com/framework/rich_text Illustrates the HTML for a center-aligned richtext component. This example showcases the use of `richtext--center`, `content--center`, and `text--center` classes to achieve centered text layout. ```html

This is an example of center-aligned rich text content.

Centered text works well for quotes or highlighted information.

``` -------------------------------- ### Responsive Value Example (HTML) Source: https://usetrmnl.com/framework/responsive Demonstrates progressive sizing for text elements. The style changes based on screen size breakpoints (md, lg). Applies to medium screens and larger, then large screens and larger. ```html Responsive Value ``` -------------------------------- ### Common Divider Usage Patterns (HTML) Source: https://usetrmnl.com/framework/divider Provides examples of how the Divider component can be used as a modern replacement for older border-based patterns. It demonstrates both the automatic background detection and manual specification methods for creating section separators. ```html
``` -------------------------------- ### Value System: XSmall Text Size with Tabular Numbers (HTML) Source: https://usetrmnl.com/framework/value Illustrates the usage of the XSmall text size variant within the Value system. This variant is suitable for secondary information and includes an example with tabular numbers. ```html Example 48,206.62 ``` -------------------------------- ### Rich Text Content Size Variants (HTML) Source: https://usetrmnl.com/framework/rich_text Demonstrates how to use different content size variants for the Rich Text component. It includes examples for large, default, and small text sizes, each intended for specific emphasis and readability needs. ```html

This is large size rich text content.
Perfect for headings and emphasis.

This is the default size for rich text content.
Optimized for readability and general use.

This is small size rich text content.
Ideal for captions and secondary information.

``` -------------------------------- ### Default Title HTML Example Source: https://usetrmnl.com/framework/title This code snippet demonstrates how to apply the default title style using the 'title' CSS class. It creates a standard-sized heading for primary content headers. ```html Default Title ``` -------------------------------- ### Small Title HTML Example Source: https://usetrmnl.com/framework/title This code snippet shows how to create a more compact heading by adding the 'title--small' class to the 'title' class. This is useful for secondary headers or in space-constrained areas. ```html Small Title ``` -------------------------------- ### Combine Scale Modifiers with Device Configurations Source: https://usetrmnl.com/framework/scale This code demonstrates how scale modifiers can be combined with device-specific classes to override the default UI scale for particular devices. It shows examples of using device defaults, overriding with a small scale, and combining with a specific device configuration. ```html
``` -------------------------------- ### Richtext Component: Left Alignment Example (HTML) Source: https://usetrmnl.com/framework/rich_text Demonstrates the HTML structure for a left-aligned richtext component. It includes the parent `.richtext` container and the `.content` child, both with left alignment modifiers. The content itself is also left-aligned. ```html

This is an example of left-aligned rich text content.

Multiple paragraphs will maintain the same alignment.

``` -------------------------------- ### Highcharts Gauge Chart Setup and Display (HTML/JavaScript) Source: https://usetrmnl.com/framework/chart This snippet sets up and displays multiple Highcharts gauge charts. It includes the necessary Highcharts library imports, HTML elements for the charts, and JavaScript to initialize and populate the gauges with data. The gauges are configured to show daily and weekly sleep metrics. ```html
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
Sunday
18% REM Sleep
23% Deep Sleep
12m Time to Sleep
7h 32min Sleep Duration
8 Toss & Turns
0.5% Snoring
``` -------------------------------- ### Rich Text with Content Limiter (HTML) Source: https://usetrmnl.com/framework/rich_text Illustrates the integration of the Rich Text component with the Content Limiter utility to handle overflowing text. This example automatically adjusts text size to fit within available vertical space, ideal for constrained layouts. ```html

The Rich Text component with Content Limiter will automatically adjust text size when content exceeds the height threshold. This is particularly useful for views with limited vertical space.

``` -------------------------------- ### Row Positioning (HTML) Source: https://usetrmnl.com/framework/grid This snippet shows how to control the horizontal alignment of rows within a grid using `row--{position}` classes, where `position` can be `start`, `center`, or `end`. ```html
{{ Item }}
{{ Item }}
{{ Item }}
``` -------------------------------- ### Column Positioning (HTML) Source: https://usetrmnl.com/framework/grid This snippet demonstrates controlling the vertical alignment of columns within a grid using `col--{position}` classes, where `position` can be `start`, `center`, or `end`. ```html
{{ Item }}
{{ Item }}
{{ Item }}
``` -------------------------------- ### Control Rich Text Width with Size Utility Classes (HTML) Source: https://usetrmnl.com/framework/rich_text Shows how to control the width of Rich Text content using Size utility classes. This example applies a fixed width of 240 pixels to constrain the text, demonstrating precision in layout control. ```html

This Rich Text content has a fixed width of 240 pixels using utility classes.

Notice how the text is constrained to this specific width regardless of the container size.

``` -------------------------------- ### Richtext Component: Right Alignment Example (HTML) Source: https://usetrmnl.com/framework/rich_text Presents the HTML structure for a right-aligned richtext component. This code uses `richtext--right`, `content--right`, and `text--right` modifiers to align the content to the right. ```html

This is an example of right-aligned rich text content.

Right alignment can be used for captions or sidebars.

``` -------------------------------- ### SCSS: Apply Flexbox Layout Conditionally with screen.screen() Source: https://usetrmnl.com/framework/responsive_test This snippet provides examples of using the `screen.screen()` SCSS mixin to apply conditional flexbox utilities. It demonstrates controlling flexbox properties like alignment and direction based on responsive conditions. ```scss @include screen.screen('md') // Resulting CSS class: md:flex--center // Description: Centered flex items on md+ screens @include screen.screen('portrait') // Resulting CSS class: portrait:flex--col // Description: Column layout for flex items in portrait mode @include screen.screen('lg', 'portrait') // Resulting CSS class: lg:portrait:flex--center // Description: Centered flex items on lg+ screens in portrait mode ``` -------------------------------- ### Define Grid Columns by Count (HTML) Source: https://usetrmnl.com/framework/grid This snippet demonstrates how to define grid column layouts by specifying the number of columns using the `grid--cols-{number}` class on the parent element. It shows examples for 4 and 3 columns. ```html
1/4
1/4
1/4
1/4
1/3
1/3
1/3
``` -------------------------------- ### HTML Example for Overflow Legacy Attributes Source: https://usetrmnl.com/framework/overflow This HTML snippet demonstrates the usage of legacy attributes for overflow handling within a column structure. It includes `data-list-limit` to enable overflow, `data-list-max-height` to set a height budget, `data-list-hidden-count` to show a hidden count label, and `data-list-max-columns` to define the maximum number of columns. ```html
``` -------------------------------- ### Multi-Series Line Chart with Highcharts Source: https://usetrmnl.com/framework/chart This snippet generates a multi-series line chart using Highcharts to compare 'Current' and 'Previous' period data. It includes necessary script imports, chart container setup, data definition, and chart configuration with custom styling for each series. Dependencies include the Highcharts library and its pattern-fill module. ```html
$85,240 Total Sales
32 Pending Orders
Jul 01 - Jul 15
Current
$128 AOV
665 Fulfilled Orders
Jun 15 - Jun 30
Previous
``` -------------------------------- ### Fit Value - Basic HTML Usage Source: https://usetrmnl.com/framework/fit_value Demonstrates how to apply the Fit Value system to numeric content using HTML. By adding the 'data-value-fit="true"' attribute to a span element with a numeric value, the system will automatically adjust the font size and weight to fit the container. This example shows different large numeric values being fitted. ```html $1,000 $1,000,000 $1,000,000,000 ``` -------------------------------- ### Implement Responsive Sizes with Framework Classes Source: https://usetrmnl.com/framework/size Apply different width and height values at various screen sizes using responsive prefixes like `md:` and `lg:`. This enables mobile-first design, where styles cascade upwards from smaller breakpoints. ```html
Responsive Width
Responsive Height
``` -------------------------------- ### Apply Dynamic Width with Framework Classes Source: https://usetrmnl.com/framework/size Utilize `w--full` for elements that should span the full width of their container, and `w--auto` for elements that should automatically adjust their width based on content. ```html
Full width
Auto width
``` -------------------------------- ### HTML: Value Component Responsive Sizes Source: https://usetrmnl.com/framework/value Shows how to implement responsive text sizing for the Value component using breakpoint prefixes like `sm:`, `md:`, and `lg:`. This allows the text size to adapt dynamically to different screen widths for optimal readability. ```html Responsive Value 1,234.56 ``` -------------------------------- ### Apply Background Patterns with bg--{shade} Utility Classes Source: https://usetrmnl.com/framework/background Demonstrates the usage of `bg--{shade}` utility classes to apply background patterns to HTML elements. These classes offer sixteen distinct shade values from black to white, including intermediate grays. ```html
Black
Gray 10
Gray 15
Gray 20
Gray 25
Gray 30
Gray 35
Gray 40
Gray 45
Gray 50
Gray 55
Gray 60
Gray 65
Gray 70
Gray 75
White
``` -------------------------------- ### HTML: Responsive Label Styling by Size Source: https://usetrmnl.com/framework/label Demonstrates applying responsive label styles based on screen size breakpoints using prefixes like `md:` and `lg:`. This allows for dynamic changes in label appearance across different devices and viewport sizes. ```html Responsive Label Progressive Styles ``` -------------------------------- ### Set Min/Max Width with Framework Classes Source: https://usetrmnl.com/framework/size Control minimum and maximum width constraints independently using `w--min-{size}` and `w--max-{size}` classes. These classes ensure elements respect defined width limits. ```html
Min Width 72 (288px)
Max Width 32 (128px)
``` -------------------------------- ### Progress Dots Sizes (HTML) Source: https://usetrmnl.com/framework/progress Shows how to implement progress dots in small, regular, and large sizes. Size variations are controlled by adding classes like 'progress-dots--small' or 'progress-dots--large' to the main '.progress-dots' container. Each dot represents a discrete step in a process. ```html
``` -------------------------------- ### Apply Device Variants and Modifiers (HTML) Source: https://usetrmnl.com/framework/screen Illustrates using device-specific classes (e.g., `screen--og`, `screen--v2`) and bit-depth modifiers (e.g., `screen--1bit`, `screen--4bit`) to configure screen dimensions and color depth. Shows combining orientation and other modifiers. ```html
``` -------------------------------- ### HTML: Value Component Orientation and Size+Orientation Source: https://usetrmnl.com/framework/value Demonstrates how to control the Value component's size based on device orientation using `portrait:` and combining orientation with size breakpoints (e.g., `md:portrait:`). This provides granular control over text display in different contexts. ```html Orientation Variant 42,000.00 ``` -------------------------------- ### Initialize Daily and Weekly Gauges (JavaScript) Source: https://usetrmnl.com/framework/chart Iterates through daily scores to create small gauge charts and creates a main weekly gauge chart. This script utilizes the `createGauge` function with specific options for daily and weekly views, adjusting font sizes and axis titles accordingly. ```javascript // Create small daily gauges dailyScores.forEach((score, idx) => { let opts = { title: null, labels: { enabled: false }, series: { fontSize: "16px", fontWeight: "400", fontFamily: "NicoClean" }, yAxis: { title: null } } createGauge(score, idx, opts); }); // Create main weekly gauge createGauge(weeklyScore, "all", { title: null, height: "80%", labels: { distance: 15 }, series: { fontSize: "3em", fontWeight: "550" }, yAxis: { title: textRating(weeklyScore) } }); ``` -------------------------------- ### HTML Structure for XSmall Table Source: https://usetrmnl.com/framework/table This HTML snippet demonstrates the structure for an XSmall table using the `table--xsmall` class. It includes table headers and a sample row with cells, all styled for a compact appearance. This structure is essential for optimizing space in tabular data presentations. ```html
Employee Role Pranks Sales Score Fun Fact
Row 1, Cell 1 Row 1, Cell 2 Row 1, Cell 3
``` -------------------------------- ### Set Min/Max Height with Framework Classes Source: https://usetrmnl.com/framework/size Define minimum and maximum height constraints using `h--min-{size}` and `h--max-{size}` classes. `h--min` ensures a minimum height, while `h--max` prevents exceeding a specified height. ```html
Min Height 72 (288px)
Max Height 8 (32px)
``` -------------------------------- ### HTML: Responsive Label Styling by Orientation Source: https://usetrmnl.com/framework/label Explains how to apply responsive label styles based on screen orientation (e.g., portrait) using prefixes like `portrait:`. This enables distinct label appearances depending on whether the device is held vertically or horizontally. ```html Orientation Aware Portrait Enhancement ``` -------------------------------- ### Flexbox Item Self Alignment Source: https://usetrmnl.com/framework/flex Allows individual flex items to control their alignment along the cross-axis using `self--start`, `self--center`, `self--end`, and `self--stretch`. This utility does not affect sibling items. ```html
self--start
self--center
self--end
self--stretch
``` -------------------------------- ### Responsive Gap Application Source: https://usetrmnl.com/framework/gap Shows how to apply different gap values based on screen size and orientation using responsive prefixes like 'md:', 'portrait:', and 'md:portrait:'. The framework uses a mobile-first approach, allowing larger breakpoints to inherit smaller ones. ```html
...
...
...
...
...
``` -------------------------------- ### Progress Bar Sizes (HTML) Source: https://usetrmnl.com/framework/progress Demonstrates how to create progress bars in small, regular, and large sizes. The size is controlled by adding specific classes like 'progress-bar--small' or 'progress-bar--large' to the main container. The fill percentage is set using inline style on the '.fill' element. ```html
Small Progress 25%
Regular Progress 50%
Large Progress 75%
``` -------------------------------- ### Combined Responsive Features for Labels (HTML) Source: https://usetrmnl.com/framework/label This snippet shows how to combine multiple responsive systems (size, orientation, bit-depth) for highly targeted label styling. The pattern `size:orientation:bit-depth:utility` allows for complex responsive combinations. ```html Advanced Targeting Multi-Condition ``` -------------------------------- ### HTML for Group Headers with Overflow Source: https://usetrmnl.com/framework/overflow This HTML structure demonstrates how group headers are implemented using `div` elements with specific classes. The `data-overflow-max-cols` attribute controls the maximum number of columns, and `group-header` class with `data-group-header='true'` identifies header elements. This setup handles content overflow and ensures headers are not orphaned. ```html
Today Tomorrow This Week
``` -------------------------------- ### Toggle Screen Orientation (HTML) Source: https://usetrmnl.com/framework/screen Demonstrates how to use the `screen--portrait` modifier to swap width and height dimensions for portrait orientation. The framework automatically adjusts layout calculations. ```html
```