Create layout boxes with different styles.
UIkit uses panels to outline certain sections of your content, which can be styled differently. Typically, panels are arranged in grid columns from the Grelha component.
Usage
The Panel component consists of the panel itself, the panel title and a panel badge. To prevent redundant white space, top and bottom margins are removed from the panel’s content.
Class | Description |
---|---|
.uk-panel | Add this class to a <div> element to define the Panel component. |
.uk-panel-title | Add this class to a heading to create the panel title. |
.uk-panel-badge | Add this class to a <div> element to create a panel badge. The easiest way to style your badge, is por adding the modifier classes from the Badge component. |
Example
Title
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
NOTE By default, a panel is blank and has no styling. That is why it is important to add a modifier class, which gives the panel some styling. In our examples we used the .uk-panel-box
class.
Markup
<div class="uk-panel">
<div class="uk-panel-badge uk-badge">...</div>
<h3 class="uk-panel-title">...</h3>
...
</div>
Panels in a grid
This is a short example of how to use panels with the Grelha component. Both panels are using the .uk-width-medium-1-2
class.
Example
Title
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor.
Title
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor.
Markup
<div class="uk-grid">
<div class="uk-width-medium-1-2">
<div class="uk-panel">...</div>
</div>
<div class="uk-width-medium-1-2">
<div class="uk-panel">...</div>
</div>
</div>
Modifiers
Modifier classes are necessary to add a specific style to panels. UIkit includes a number of panel modifiers and you also have the possibility to create your own.
Panel box
Add the .uk-panel-box
class to create a visually styled box. This is the default panel modifier.
Example
Title
Lorem ipsum dolor sit amet, consectetur adipisicing elit. .uk-panel-box
Title
Lorem ipsum dolor sit amet, consectetur adipisicing elit. .uk-panel-box
Title
Lorem ipsum dolor sit amet, consectetur adipisicing elit. .uk-panel-box
Markup
<div class="uk-panel uk-panel-box">...</div>
NOTE To create a hover effect on the panel, just add the .uk-panel-box-hover
class. This comes in handy when working with anchors.
Panel box primary
Add the .uk-panel-box-primary
class to modify the box panel and emphasize it with a different color.
Example
Title
Lorem ipsum dolor sit amet, consectetur adipisicing elit. .uk-panel-box-primary
Title
Lorem ipsum dolor sit amet, consectetur adipisicing elit. .uk-panel-box-primary
Title
Lorem ipsum dolor sit amet, consectetur adipisicing elit. .uk-panel-box-primary
Markup
<div class="uk-panel uk-panel-box uk-panel-box-primary">...</div>
NOTE To create a hover effect on the panel, just add the .uk-panel-box-primary-hover
class. This comes in handy when working with anchors.
Panel box secondary
Add the .uk-panel-box-secondary
class to modify the box panel and give it a white background.
Example
Title
Lorem ipsum dolor sit amet, consectetur adipisicing elit. .uk-panel-box-secondary
Title
Lorem ipsum dolor sit amet, consectetur adipisicing elit. .uk-panel-box-secondary
Title
Lorem ipsum dolor sit amet, consectetur adipisicing elit. .uk-panel-box-secondary
Markup
<div class="uk-panel uk-panel-box uk-panel-box-secondary">...</div>
NOTE To create a hover effect on the panel, just add the .uk-panel-box-secondary-hover
class. This comes in handy when working with anchors.
Panel hover
Add the .uk-panel-hover
class to add a hover effect to the panel. This comes in handy when using the panel as an anchor.
Example
Markup
<a class="uk-panel uk-panel-hover" href="">...</a>
Panel header
Add the .uk-panel-header
class to separate the panel title and content with a horizontal line.
Example
Title
Lorem ipsum dolor sit amet, consectetur adipisicing elit. .uk-panel-header
Title
Lorem ipsum dolor sit amet, consectetur adipisicing elit. .uk-panel-header
Title
Lorem ipsum dolor sit amet, consectetur adipisicing elit. .uk-panel-header
Markup
<div class="uk-panel uk-panel-header">...</div>
Panel space
Add the .uk-panel-space
class to increase the spacing around the panel content.
Example
Title
Lorem ipsum dolor sit amet, consectetur adipisicing elit. .uk-panel-space
Title
Lorem ipsum dolor sit amet, consectetur adipisicing elit. .uk-panel-space
Title
Lorem ipsum dolor sit amet, consectetur adipisicing elit. .uk-panel-space
Markup
<div class="uk-panel uk-panel-space">...</div>
Panel divider
Add the .uk-panel-divider
class to separate vertically stacked panels with lines.
Example
Title
Lorem ipsum dolor sit amet, consectetur adipisicing elit. .uk-panel-divider
Title
Lorem ipsum dolor sit amet, consectetur adipisicing elit. .uk-panel-divider
Title
Lorem ipsum dolor sit amet, consectetur adipisicing elit. .uk-panel-divider
Markup
<div class="uk-grid">
<div class="uk-width-medium-1-2">
<div class="uk-panel uk-panel-divider">...</div>
<div class="uk-panel uk-panel-divider">...</div>
<div class="uk-panel uk-panel-divider">...</div>
</div>
</div>
NOTE Use the .uk-grid-divider
class from the Grelha component to separate grid columns.
Panel box with teaser
To display an image inside a panel box that is attached to the border of the panel without any spacing, just add the .uk-panel-teaser
class to a <div>
element inside the panel.
Example
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
Markup
<div class="uk-panel uk-panel-box">
<div class="uk-panel-teaser">
<img src="" alt="">
</div>
</div>
Panel with icons
Easily apply an icon from our Icon component to your panel por adding one of the .uk-icon-*
classes to an <i>
or <span>
element inside the panel title.
Example
Panel
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Panel
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Panel
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Markup
<div class="uk-panel">
<h3 class="uk-panel-title"><i class="uk-icon-*"></i>...</h3>
</div>