Scroll Area
v0.0.10
mix mishka.ui.gen.component scroll_area
Overview Scroll area Phoenix LiveView component
The Scroll Area component in Mishka Chelekom provides a clean and efficient way to handle scrollable content within your Phoenix LiveView application.
This component can be integrated with various other components, such as table contents, Drawer, Sidebar, to create scrollable areas that are easily navigable using keyboard or touch input on mobile devices.
Overview Scroll area Phoenix LiveView component
<.scroll_area id="unique_id">
// Content
</.scroll_area>Horizontal prop
The horizontal prop is a boolean that enables horizontal scrolling. By default, it's set to false.
Horizontal prop
<.scroll_area id="unique_id" horizontal vertical={false}>
// Content
</.scroll_area>Vertical prop
The vertical prop is a boolean that enables vertical scrolling. By default, it's set to true.
Vertical prop
<.scroll_area id="unique_id" vertical={false}>
// Content
</.scroll_area>Type prop
The type prop allows you to control the scrollbar's visibility and behavior. Available options are: auto (default) - scrollbar is always visible, never - scrollbar is hidden, and hover - scrollbar appears only when hovering over the content.
Type prop
<.scroll_area id="unique_id" type="auto">
// Content
</.scroll_area>
<.scroll_area id="unique_id" type="hover">
// Content
</.scroll_area>
<.scroll_area id="unique_id" type="never">
// Content
</.scroll_area>Width prop
The width prop allows you to control the width of the scroll area using Tailwind CSS width classes.
Width prop
<.scroll_area id="scroll-area-1" width="w-full md:w-2/3">
// Content
</.scroll_area>Padding prop
The padding prop allows you to control the padding size of the scroll area content using Tailwind CSS width classes.
Padding prop
<.scroll_area id="scroll-area-2" padding="extra_small"></.scroll_area>
<.scroll_area id="scroll-area-3" padding="small"></.scroll_area>
<.scroll_area id="scroll-area-4" padding="medium"></.scroll_area>
<.scroll_area id="scroll-area-5" padding="large"></.scroll_area>
<.scroll_area id="scroll-area-6" padding="extra_large"></.scroll_area>Height prop
The height prop allows you to control the height of the scroll area using Tailwind CSS height classes.
Height prop
<.scroll_area id="scroll-area-7" height="h-fit md:h-80">
// Content
</.scroll_area>Content class prop
The content_class prop allows you to add custom styles to the content area of the scroll component.
Content class prop
<.scroll_area id="scroll-area-8" content_class="py-7 px-1">
// Content
</.scroll_area>Attributes
| Name | Type | Default | Values | Required | Description |
|---|---|---|---|---|---|
id
|
string
| — | — | Yes | A unique identifier is used to manage state and interaction |
type
|
string
|
auto
| — | No | hover, auto, never |
horizontal
|
boolean
|
false
| — | No | Enables horizontal scrollbar visibility |
vertical
|
boolean
|
true
| — | No | Enables vertical scrollbar visibility |
height
|
string
|
h-96
| — | No | Determines height of wrapper |
width
|
string
|
w-full
| — | No | Determines width of wrapper |
padding
|
string
|
extra_small
|
extra_smallsmallmediumlargeextra_largenone
| No | Add paddings to content |
class
|
any
| — | — | No | Custom CSS class for the scroll area wrapper |
content_class
|
string
| — | — | No | Custom CSS class for the inner content area |
scrollbar_width
|
string
|
w-2
| — | No | Custom CSS class for vertical scrollbar width |
scrollbar_height
|
string
|
h-2
| — | No | Custom CSS class for horizontal scrollbar height |
rest
|
global
| — | — | No | Global attributes can define defaults which are merged with attributes provided by the caller |
Slots
| Name | Required | Description |
|---|---|---|
inner_block
| Yes | Inner block that renders HEEx content |
Options
Each option takes one or more of its values, separated by commas.
| Option | Values |
|---|---|
--padding
|
extra_smallsmallmediumlargeextra_largenone
|
--module
| A module name of your own |
What it generates
mix mishka.ui.gen.component scroll_area
