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.
<.scroll_area id="unique_id"> // Content </.scroll_area>
If the generator did not automatically add the required styles, please add the following CSS code to your stylesheet:
.hide-scrollbar { -ms-overflow-style: none; scrollbar-width: none; } .hide-scrollbar::-webkit-scrollbar { display: none; }
Horizontal prop
The
horizontal
prop is a
boolean
that enables horizontal scrolling. By default, it's set to
false
.
<.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
.
<.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.
<.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.
<.scroll_area 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.
<.scroll_area padding="extra_small"></.scroll_area> <.scroll_area padding="small"></.scroll_area> <.scroll_area padding="medium"></.scroll_area> <.scroll_area padding="large"></.scroll_area> <.scroll_area 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.
<.scroll_area 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.
<.scroll_area content_class="py-7 px-1"> // Content </.scroll_area>