Progress
v0.0.10
mix mishka.ui.gen.component progress
Overview of the Phoenix LiveView progress Component
The Phoenix LiveView Progress component is a highly customizable and versatile component designed for creating visually dynamic progress bars including horizontal, vertical, ring, and semi-circle progress indicators.
Overview of the Phoenix LiveView progress Component
This Phoenix LiveView component also supports advanced features like chunked progress bars, allowing you to visually represent multiple stages of progress within a single bar. Additionally, the gradient variant adds dynamic styling, enabling smooth color transitions that enhance the visual appeal of your progress indicators.
Base variant
Base variant
<.progress />Default variant
The default variant of the progress component offers a wide range of color options to suit different design needs. You can customize the progress bar's appearance by choosing from the following colors: white, primary, secondary, dark, success, warning, danger, info, silver, misc, and dawn. These options ensure that your progress bar can seamlessly integrate with your application's overall color scheme.
Default variant
<.progress variant="default" color="natural" />
<.progress variant="default" color="white" />
<.progress variant="default" color="primary" />
<.progress variant="default" color="secondary" />
<.progress variant="default" color="dark" />
<.progress variant="default" color="success" />
<.progress variant="default" color="warning" />
<.progress variant="default" color="danger" />
<.progress variant="default" color="info" />
<.progress variant="default" color="silver" />
<.progress variant="default" color="misc" />
<.progress variant="default" color="dawn" />Gradient variant
The gradient variant of the progress component introduces a visually appealing gradient effect, allowing you to apply smooth transitions between colors. You can use any of the following color options for the gradient effect: natural, primary, secondary, success, warning, danger, info, silver, misc, and dawn.
Gradient variant
<.progress variant="gradient" color="natural" />
<.progress variant="gradient" color="primary" />
<.progress variant="gradient" color="secondary" />
<.progress variant="gradient" color="success" />
<.progress variant="gradient" color="warning" />
<.progress variant="gradient" color="danger" />
<.progress variant="gradient" color="info" />
<.progress variant="gradient" color="silver" />
<.progress variant="gradient" color="misc" />
<.progress variant="gradient" color="dawn" />Value prop
The value prop shows the percentage of progress completed, ranging from 0 to 100. For example, setting the value to 50 will indicate that 50% of the task or process is complete, visually reflecting the progress on the bar.
Value prop
<.progress value={4} />
<.ring_progress id="ring-progress-1" value={32} />
<.semi_circle_progress value={77} />Variation prop
The variation prop allows you to define the orientation of the progress bar, with options for either horizontal or vertical. By default, the progress bar is set to horizontal, making it ideal for typical linear progress indicators. However, when vertical is selected, the progress bar is displayed in an upright format, offering a different visual representation of progress.
Variation prop
<!--Horizontal-->
<.progress />
<.progress variation="horizontal" />
<.progress variation="vertical" />Size prop
The size prop adjusts the visual dimensions of the progress bar for both horizontal and vertical orientations. It offers predefined options such as extra_small, small, medium, large, extra_large, double_large, triple_large, and quadruple_large. In horizontal mode, this prop changes the height of the progress bar, while in vertical mode, it adjusts the width and overall height.
Size prop
<.progress size="extra_small" />
<.progress size="small" />
<.progress size="medium" />
<.progress size="large" />
<.progress size="extra_large" />
<.progress size="double_large" />
<.progress size="triple_large" />
<.progress size="quadruple_large" />
<.progress variation="vertical" size="extra_small" />
<.progress variation="vertical" size="small" />
<.progress variation="vertical" size="medium" />
<.progress variation="vertical" size="large" />
<.progress variation="vertical" size="extra_large" />
<.progress variation="vertical" size="double_large" />
<.progress variation="vertical" size="triple_large" />
<.progress variation="vertical" size="quadruple_large" />Progress section component
All the previously mentioned props, can also be applied to each section when using the progress_section within the progress component.
Progress section component
<.progress>
<.progress_section color="dawn" value={80} />
</.progress>Chunked or segmented progress in Phoenix LiveView
By utilizing progress_section, you can easily create chunked(or segmented) progress bars within the progress component. By defining multiple sections, each with its own value, color, and variant, you can visually segment the progress bar into distinct parts. This feature allows for more granular representation of progress, such as showing different stages of a process or multiple tasks within the same progress bar.
Chunked or segmented progress in Phoenix LiveView
<.progress>
<.progress_section csp_nonce={@csp_nonce} color="primary" value={10} />
<.progress_section csp_nonce={@csp_nonce} color="secondary" value={15} />
<.progress_section csp_nonce={@csp_nonce} color="misc" value={10} />
<.progress_section csp_nonce={@csp_nonce} color="danger" value={5} />
<.progress_section csp_nonce={@csp_nonce} color="warning" value={10} />
<.progress_section csp_nonce={@csp_nonce} color="success" value={10} />
<.progress_section csp_nonce={@csp_nonce} color="info" value={5} />
</.progress>
<!--Vertical-->
<.progress
variation="vertical"
size="w-5 h-[350px]"
>
<.progress_section value={60} csp_nonce={@csp_nonce} variation="vertical">
</.progress_section>
<.progress_section value={30} csp_nonce={@csp_nonce} variation="vertical">
</.progress_section>
<.progress_section value={10} csp_nonce={@csp_nonce} variation="vertical">
</.progress_section>
</.progress>label slot
The label slot in the Progress module provides a flexible mechanism for embedding custom values or text within each chunk of a progress bar or the overall progress itself. This slot allows developers to include dynamic label, such as progress percentages, texts, or detailed information, directly inside the progress component.
label slot
<.progress size="extra_large">
<.progress_section color="primary" value={10}>
<:label class="fonte-bold">Images</:label>
</.progress_section>
<.progress_section color="secondary" value={5}>
<:label class="text-white">15%</:label>
</.progress_section>
<.progress_section color="misc" value={30}>
<:label class="font-bold">Other</:label>
</.progress_section>
</.progress>
<.progress size="extra_large">
<.progress_section csp_nonce={@csp_nonce} color="misc" value={20}>
<:label class="font-bold">80%</:label>
</.progress_section>
</.progress>CSP
If you have enabled the CSP header on your website, you must pass the csp_nonce parameter when using the progress and progress_section components. The reason for this is that part of these components is written inline to avoid the need for state.
Ring progress component
Ring progress component
<.ring_progress id="ring-progress-2" value={60} />Ring progress Value prop
The value prop in the Ring Progress component represents the current progress percentage, accepting values from 0 to 100, where 0 indicates no progress and 100 indicates completion of the task or process.
Ring progress Value prop
<.progress value={4} />
<.ring_progress id="ring-progress-3" value={32} />
<.semi_circle_progress value={77} />Ring progress Max prop
The max prop in the Ring Progress component allows you to customize the maximum value of the progress scale, defaulting to 100 if not specified, enabling you to work with different progress scales while maintaining proportional visual representation.
Ring progress Max prop
<.ring_progress id="ring-progress-4" value={30} max={60} />
<.ring_progress id="ring-progress-5" value={30} max={100} />Ring progress Size prop
The size prop in the Ring Progress component controls the overall diameter of the progress indicator in pixels. The default size is 120 pixels, but you can customize this value to create smaller or larger progress indicators based on your design needs.
Ring progress Size prop
<.ring_progress id="ring-progress-6" value={60} size={150} />Ring progress thickness prop
The thickness prop adjusts the width of the progress ring's stroke, allowing you to create thinner or thicker progress indicators. The default value is 10 pixels, and you can customize it based on your design needs.
Ring progress thickness prop
<.ring_progress id="ring-progress-7" value={60} thickness={4} />Ring progress Color prop
The color prop in the Ring Progress component allows you to customize the color theme of the progress indicator. Available color options include: natural, primary, secondary, success, warning, danger, info, silver, misc, and dawn. The default value is natural.
Ring progress Color prop
<.ring_progress id="ring-progress-8" value={60} color="natural" />
<.ring_progress id="ring-progress-9" value={60} color="white" />
<.ring_progress id="ring-progress-10" value={60} color="primary" />
<.ring_progress id="ring-progress-11" value={60} color="secondary" />
<.ring_progress id="ring-progress-12" value={60} color="dark" />
<.ring_progress id="ring-progress-13" value={60} color="success" />
<.ring_progress id="ring-progress-14" value={60} color="warning" />
<.ring_progress id="ring-progress-15" value={60} color="danger" />
<.ring_progress id="ring-progress-16" value={60} color="info" />
<.ring_progress id="ring-progress-17" value={60} color="silver" />
<.ring_progress id="ring-progress-18" value={60} color="misc" />
<.ring_progress id="ring-progress-19" value={60} color="dawn" />Ring progress Label prop
The label prop allows you to add descriptive text inside the ring progress indicator. The label appears centered within the ring, making it useful for displaying progress percentages, status messages, or other relevant information about the task being tracked.
Ring progress Label prop
<.ring_progress id="ring-progress-20" value={60} label="Uploading" />Ring progress Linecap prop
The linecap prop defines how the ends of the progress bar's stroke are drawn. It accepts three values: butt (flat ends), round (rounded ends), or square (square ends that extend beyond the path). This property can significantly affect the visual appearance of your progress indicator's endpoints.
Ring progress Linecap prop
<.ring_progress id="ring-progress-21" value={60} linecap="butt" />
<.ring_progress id="ring-progress-22" value={60} linecap="round" />
<.ring_progress id="ring-progress-23" value={60} linecap="square" />Semi circle progress component
The Semi Circle Progress component creates a visually appealing half-circle shape to display progress, with customizable features like size, thickness, orientation, colors, and labels.
Semi circle progress component
<.semi_circle_progress value={60} />Semi circle Value prop
The value prop in the Semi Circle Progress component represents the current progress percentage, accepting values from 0 to 100. For example, setting value={50} indicates that 50% of the task or process is complete. The progress arc will draw accordingly from 0% to the specified value, providing a clear visual representation of the completion status.
Semi circle Value prop
<.semi_circle_progress value={20} />Semi circle Size prop
The size prop in the Semi Circle Progress component controls the overall diameter of the progress indicator in pixels. The default size is 200 pixels, but you can customize this value to create smaller or larger progress indicators based on your design needs.
Semi circle Size prop
<.semi_circle_progress value={60} size={150} />Semi circle Thickness prop
The thickness prop in the Semi Circle Progress component controls the width of the progress arc. The default value is 12 pixels, and you can adjust it to create thinner or thicker progress indicators based on your design requirements. For example, setting thickness={6} creates a thinner line, while thickness={14} creates a thicker one.
Semi circle Thickness prop
<.semi_circle_progress value={60} thickness={2} />Semi circle Orientation prop
The orientation prop in the Semi Circle Progress component determines the direction the semi-circle faces. It accepts two values: up (default) where the arc points upward, or down where the arc points downward. This allows you to create versatile progress indicators that can be oriented according to your design needs.
Semi circle Orientation prop
<.semi_circle_progress value={60} orientation="up" />
<.semi_circle_progress value={60} orientation="down" />Semi circle Fill direction prop
The fill_direction prop in the Semi Circle Progress component determines the direction in which the progress arc is drawn. It accepts two values: left-to-right (default) or right-to-left. This allows you to customize the animation direction of the progress indicator to match your design preferences or to create visual variety in your interface.
Semi circle Fill direction prop
<.semi_circle_progress value={60} fill_direction="left-to-right"/>
<.semi_circle_progress value={60} fill_direction="right-to-left" />Semi circle Transition duration prop
The transition_duration prop in the Semi Circle Progress component controls the animation speed when the progress value changes. It accepts a value in milliseconds, where a higher number results in a slower, smoother transition and a lower number creates a faster transition. The default value is 300 milliseconds, which provides a balanced animation speed suitable for most use cases.
Semi circle Transition duration prop
<.semi_circle_progress value={60} transition_duration={150} />Semi circle Linecap prop
The linecap prop in the Semi Circle Progress component determines how the ends of the progress arc are rendered. It accepts three values: butt (flat ends), round (rounded ends), or square (square ends that extend beyond the path). This styling option can significantly impact the visual appearance of your progress indicator's endpoints, allowing you to choose between sharp or smooth transitions.
Semi circle Linecap prop
<.semi_circle_progress value={60} linecap="butt" />
<.semi_circle_progress value={60} linecap="round" />
<.semi_circle_progress value={60} linecap="square" />Semi circle Color prop
The color prop in the Semi Circle Progress component allows you to customize the color theme. Available color options include: natural, primary, secondary, success, warning, danger, info, silver, misc, and dawn. If not specified, it defaults to natural.
Semi circle Color prop
<.semi_circle_progress value={60} color="natural" />
<.semi_circle_progress value={60} color="white" />
<.semi_circle_progress value={60} color="primary" />
<.semi_circle_progress value={60} color="secondary" />
<.semi_circle_progress value={60} color="dark" />
<.semi_circle_progress value={60} color="success" />
<.semi_circle_progress value={60} color="warning" />
<.semi_circle_progress value={60} color="danger" />
<.semi_circle_progress value={60} color="info" />
<.semi_circle_progress value={60} color="silver" />
<.semi_circle_progress value={60} color="misc" />
<.semi_circle_progress value={60} color="dawn" />Semi circle Label prop
The label prop enables you to add descriptive text to display alongside the progress indicator, providing context or status information about the progress being shown.
Semi circle Label prop
<.semi_circle_progress value={60} label="Uploading" />Tooltip slot
The :tooltip slot allows you to show contextual information when hovering or clicking on a progress section. You can define a label as the trigger, and customize position, style, and interaction behavior. This is especially useful when multiple progress sections are used and you want to provide additional information for each segment.
Available attributes for the :tooltip slot:
label: Required. Text or UI element that acts as the tooltip trigger.position: Optional. Defines where the tooltip appears relative to the trigger. Supported values:"top","bottom","left","right". Default:"top". use"left"and"right"for vertical variationclickable: Optional. If set totrue, tooltip shows on click instead of hover.class: Optional. Additional custom classes for tooltip content styling.
Tooltip slot
<.progress size="extra_large">
<.progress_section color="primary" value={10}>
<:tooltip label="Images" position="top" class="font-bold">
Tooltip content for Images
</:tooltip>
</.progress_section>
<.progress_section color="secondary" value={5}>
<:tooltip label="15%" position="bottom" class="text-white">
Only 5% left
</:tooltip>
</.progress_section>
<.progress_section color="misc" value={30}>
<:tooltip label="Other" position="top" clickable={true} class="font-bold">
This section represents other files
</:tooltip>
</.progress_section>
</.progress>
<.progress size="extra_large">
<.progress_section csp_nonce={@csp_nonce} color="misc" value={20}>
<:tooltip label="80%" position="right" clickable={true} class="font-bold">
80% of content processed
</:tooltip>
</.progress_section>
</.progress>
<!--Vertical-->
<.progress
variation="vertical"
size="w-5 h-[350px]"
>
<.progress_section value={60} csp_nonce={@csp_nonce} variation="vertical">
<:tooltip label="1" position="right">Step 1</:tooltip>
</.progress_section>
<.progress_section value={30} csp_nonce={@csp_nonce} variation="vertical">
<:tooltip label="2" position="right">Step 2</:tooltip>
</.progress_section>
<.progress_section value={10} csp_nonce={@csp_nonce} variation="vertical">
<:tooltip label="3" position="right">Step 3</:tooltip>
</.progress_section>
</.progress>Attributes
| Name | Type | Default | Values | Required | Description |
|---|---|---|---|---|---|
id
|
string
| — | — | No | A unique identifier is used to manage state and interaction |
value
|
integer
| — | — | No | Value of input |
variation
|
string
|
horizontal
|
horizontalvertical
| No | Defines the layout orientation of the component |
color
|
string
|
natural
|
basenaturalwhiteprimarysecondarydarksuccesswarningdangerinfosilvermiscdawn
| No | Determines color theme |
rounded
|
string
|
full
|
extra_smallsmallmediumlargeextra_largefullnone
| No | Determines the border radius |
variant
|
string
|
base
|
defaultgradientbase
| No | Determines the style |
size
|
string
|
small
|
extra_smallsmallmediumlargeextra_largedouble_largetriple_largequadruple_large
| No | Determines the overall size of the elements, including padding, font size, and other items |
class
|
any
| — | — | No | Custom CSS class for additional styling |
csp_nonce
|
string
| — | — | No | csp nonce |
rest
|
global
| — | — | No | Global attributes can define defaults which are merged with attributes provided by the caller |
Slots
| Name | Required | Description |
|---|---|---|
inner_block
| No | Inner block that renders HEEx label |
Options
Each option takes one or more of its values, separated by commas.
| Option | Values |
|---|---|
--variant
|
defaultgradientbase
|
--color
|
basenaturalwhiteprimarysecondarydarksuccesswarningdangerinfosilvermiscdawn
|
--size
|
extra_smallsmallmediumlargeextra_largedouble_largetriple_largequadruple_large
|
--rounded
|
extra_smallsmallmediumlargeextra_largefullnone
|
--type
|
progressprogress_sectionsemi_circle_progressring_progress
|
--module
| A module name of your own |
What it generates
mix mishka.ui.gen.component progress