<% @side_nav = "css" %>
<% @page_title = "Panels" %>

<%= @page_title %>

A panel is a simple, helpful Foundation component that enables you to outline sections of your page easily. This allows you to view your page sections as you add content to them or add emphasis to a section. The width is controlled by the grid columns you put them inside.

This is a regular panel.

It has an easy to override visual style, and is appropriately subdued.

This is a callout panel.

It's a little ostentatious, but useful for important content.


Build With Predefined HTML Classes

There are two ways to build panels in Foundation 4, either with our predefined HTML or with our mixin. Building panels using our predefined class isn't hard at all. You'll start with <div> and add a class of .panel to it. From there, you just need to add content inside, anything will do.

Available HTML class options:

  • Adding .callout to your panel will make it our default blue and add a shiny top edge to help it stand out.
  • You may also you .radius to add a tasteful border-radius to thie mix.
<%= code_example '
', :html %>
Basic panel with content.

For these styles to come across, make sure you have the default Foundation CSS package or that you've selected panels from a custom package. These should be linked up following our default HTML page structure.


Build with a Mixin

We've included SCSS mixins used to style panels so that you can code smarter. To use the mixin, you'll need to have the extension installed or grab _foundation-global.scss, _global.scss and _panels.scss from Github and throw them into a Foundation folder in your project directory. From there, you can import the files at the top of your own SCSS stylesheet, like so:

<%= code_example ' @import "foundation/foundation-global", "foundation/components/global", "foundation/components/panels"; ', :css %>

If you are using the mixins, you may include the styles on whatever class or ID you'd like to the <div>.

<%= code_example '
', :html %>
Quick Mixin

You can build your panel using our global mixin by including it on your own custom class or ID. The mixin contains all the necessary styles and they can be customized a bit within the mixin. The rest of the important styles are controlled by variables. The code looks like this:

<%= code_example ' .your-class-name { @include panel; }', :css %>
Panel content goes here...

You also have two options available to customize the panel within the mixin. These control the background color (which also effect border and font color) and the interior padding of the panel itself.

<%= code_example ' .your-class-name { @include panel($bg, $padding); } /* This controls the background color, border color and type color based on brightness of the bg. */ $bg: $secondary-color /* This controls the interior padding */ $padding: $panel-padding ', :css %>
Custom panel. Hell yeah! We used @include panel(pink, 40px);
Default SCSS Variables
<%= code_example ' /* We use these to control the background and border styles */ $panel-bg: darken(#fff, 5%); $panel-border-style: solid; $panel-border-size: 1px; /* We use this % to control how much we darken things on hover */ $panel-function-factor: 10%; $panel-border-color: darken($panel-bg, $panel-function-factor); /* We use these to set default inner padding and bottom margin */ $panel-margin-bottom: emCalc(20px); $panel-padding: emCalc(20px); /* We use these to set default font colors */ $panel-font-color: #333; $panel-font-color-alt: #fff;', :css %>

Note: emCalc(); is a function we wrote to convert px to em. It is included in _foundation-global.scss.

<%= render "_sidebar-components.html.erb" %>