Quick and Easy Interactive Wireframes with Bootstrap


Web design is an evolving profession. While a keen eye for color, typography, and layout will always be important, these skills are being trumped by a need to understand user motivations. It isn't enough to build a site and wait for traffic to roll in — sites must help users achieve their goals, with a minimum of cognitive friction. Bootstrap can help web professionals define these goals, and create a killer experience, too.

we're not making pages, we're making movies

I like to say we're not making pages, we're making movies. Users expect sites to load quickly, provide engaging content, and smart interactivity. Just as movies depend on quick cuts, lighting, and mood to draw users in, websites rely on transitions, interactivity, and timing. These details often get lost during the design phase—or worse, are never accounted for. While a transition that takes 0.5 seconds when it should take 0.25 seconds usually won’t sink an application, it is this level of detail separating good from great.

I will show you how Bootstrap can replace static wireframes and bring these details to the forefront earlier and with less effort.

Step 1: Setup Project

The first step is to download the latest stable Bootstrap and jQuery builds.

Though jQuery is hosted by a number of CDNs, I prefer to include all files locally so I can work with or without web access. Go ahead and set up a directory structure like the one below, and copy the unminified Bootstrap CSS, Bootstrap Responsive CSS, and Javascript files. Tweak names and locations as needed, but using this structure means you can also leverage my HTML template in the next step.

Now would be a good time to create a third stylesheet, which I will call user.css. This file will be used to override Bootstrap styles as needed.

Directory structure for Boostrap wireframes

Step 2: Create index.html and Verify Paths

This is the only other setup required to start building an interactive wireframe. Create a file in your project directory root, and name it index.html. After you have created the file, copy this code and save.

Open a web browser and drag the saved index.html file into it. If all of the includes are properly loaded, you should see something similar to the screenshot below. If you don't see the alert box, open the Console or Web Inspector and see if a file has failed to load. After troubleshooting, remove or comment out the alert line in the $(document).ready function at the bottom of the page and get ready to build Bootstrap wireframes.

Web browser with Javascript alert box open

Step 3: Rough in Your Content Blocks

With all the necessary files in place, we can start roughing in the main content blocks. Most sites (apps) will contain a header, primary navigation, main content well, sidebar, and footer. I am deliberately keeping the layout simple, to quickly illustrate the power of Bootstrap’s grid system.

The only structural markup on the page so far is our div with class “container”.

Note: This div is a required containing block for Bootstrap; we will build our entire wireframe application inside it.

Bootstrap also requires the new HTML doctype, and generates its style rules with classes, instead of tag names. These decisions mean we can use some new HTML5 elements: header, navigation, section, article, aside, and footer. It is worth mentioning if you plan to test your layout in Internet Explorer, you will need to download and include either Modernizr, or the HTML5 Shim. Modern versions of Firefox, Chrome, and Safari natively support the HTML5 standard.

Bootstrap is built on a 12 column grid. It uses two classes, row and span to create block-level containers. By applying the row class to a container like a div or header, it automatically stretches across the entire 940px width. By adding containers with class spanN (N being a placeholder for the number of columns), you can easily create content wells, sidebars, and other layout blocks without having to manage floats or other quirks.

To get up and running quickly, I am going to build a basic header, navigation bar, main well, aside, and footer. Replace the "Your layout will go here" with the following code.

I also added a few basic rules to user.css, to make the content blocks easier to identify. If all has gone well, you should see a number of gray blocks with black descriptive text inside.

Multiple content blocks properly floated and ordered

Step 4: Fixed, Fluid, Responsive!

Fixed and fluid layouts have been around for a long time. Responsive layouts are relatively new, and combine the best parts of both. It gives designers tools to optimize their designs for multiple device sizes (smartphones, tablets, narrow and widescreen displays) without having to maintain a separate codebase for each. Resize your browser window to see Bootstrap’s responsive stylesheet in action, and get a feel for the awesome ability to write once and test wireframes in a number of environments.

Browsers make use of CSS break points to decide how to render a page, based on minimum and maximum width measurements. Break points in relation to browser width always begin with @media (width argument) and are very easy to read. They can also contain a second argument in another set of parenthesis, which allows a great deal of flexibility for multiple devices.

In the code sample below, I have created several rules that define background colors for four common Bootstrap responsive break points, modified slightly to show a smooth transition from one color to the next.

We’ve built a fully responsive layout, but we're still missing the good stuff. The rest of this tutorial will show you how to add visual interest through content and interactivity.

Step 5: Sound Off!

Now that the scaffolding is in place, we can start adding content. I am deliberately keeping these views generic—gray boxes with minimal styles encourage beta users to focus squarely on the interaction, and not get too hung up on the visual style.

The Hero Unit is designed to create a front–and–center call to action. Code downloads, new applications, or breaking news items are good candidates. For our purposes, I will use it to announce a major software upgrade. Replace the existing h2 and p tags in the main content well with the code below and refresh your browser to see the hero in action.

The hero unit is a good start, but people want to see where their time and money will be going. An image gallery is a strong follow up, and is a snap to implement. Images are laid out using the same spanN grid that defines layout blocks, and can easily be extended to include headlines, tags, captions, or microdata. For now, we will use to generate three gray boxes underneath our hero unit.

I am a big believer in semantic markup, so we will be using the HTML5 figure and figcaption tags for increased context. Even if none of your users are browsing with a screenreader or other assistive device, descriptive markup is a best practice for UX and front–end development.

Add an unordered list and a few images inside the main content well, below your hero element like so:

Another browser refresh should yield a layout similar to this, when viewed widescreen.

Hero unit and 3 inline images

Step 6: Tabbed Navigation

The hero unit and images add a lot of visual interest, but highlight our next challenge: the bullet point links standing in for a proper navigation element.

Bootstrap has several built-in navigation styles, so experimentation is encouraged. I am going to highlight the tabbed navigation here. Our first order of business is to replace the basic navigation list:

Next, let’s remove the gray background from our header and nav elements. Add the following four lines to the end of your user.css file.

We also need to update the main content well. I have added a class of tab-content to the section element, and wrapped the hero and images in a div with class="tab-pane active" and id="tab1". I added three additional div elements below, with ID’s matching the navigation link tags. These three blocks are stubs to be filled in later, but will be useful for testing. Update the section markup and refresh the browser. If everything goes right, you should be able to toggle through the tabs and view the stubbed in content.

Tab 4 Contact Us selected to show navigation functionality

Step 7: Tooltips and Popovers

Tabs are cool, but they’re also just a start. Though the Internet is fast becoming segmented and application–like, it is still driven by links from one resource to another. Links are used to hook pages together, provide additional context, and sometimes, to house secondary functions. Tooltips and popovers are good examples of secondary function; they are easily implemented with custom data-attributes.

What are data-attributes? Per John Resig, who wrote about these devices clear back in 2008:

Simply, the specification for custom data attributes states that any attribute that starts with "data-" will be treated as a storage area for private data (private in the sense that the end user can't see it - it doesn't affect layout or presentation).

This means we can add custom data to our link tags, and Bootstrap will handle it accordingly.

Suppose our image gallery is made up of technical information. The descriptions might include terminology that is unclear to the average user. Activate tooltips by replacing the image gallery HTML, starting with the unordered list, and adding a jQuery $(document).ready function and Bootstrap’s tooltip function to the bottom of the page.

With the HTML and Javascript in place, refresh the browser and roll over the gallery links to reveal your tooltips.

Basic search typeahead functionality

We are now going to add sharing to our image gallery (at least in a wireframe-y way) with popovers. Popovers are activated by including data-attributes in your markup, and another snippet of JavaScript.

First, let’s add a share button to each of our image captions. Add the code block just below the closing paragraph tag in each figcaption.

It might seem strange to put each item on its own line, but I have found Bootstrap is fairly picky about well-formed markup, and it is easier to spot errors one line at a time. We need to write a few lines of JavaScript and the popovers will be ready.

This time we have added a general links function to prevent our screen from jumping when users click on the Share button. Without delving too far into specifics, each action on a web page registers an event, which we are capturing here as the function argument 'e'. By intercepting this event, and replacing it with our custom JavaScript, the page stays where it should and our popover appears as expected.

Basic share functionality shown in a small popover

Step 8: Creating Modal Windows

Whew. After all of that, modal windows are going to be a cakewalk. Bootstrap makes modal windows available by adding a block of HTML to the top of your container, and a button or link with an href that matches the modal window ID. First, the modal HTML.

The only other thing to do is add our trigger. Since this is an application, we would be right to assume there will be a login sequence. I have modified the header to shorten the banner area, and add our Login button next to the search box. Change the following HTML, and add the CSS to the end of your user.css file.

Refresh and click the Login button. You should be rewarded with a quick animation, and the modal window presenting front and center.

Hero unit and 3 inline images

Step 9: How Will I Find Anything?

This interactive wireframe is coming along nicely. We have navigation that works, lots of blocks for adding content, interactivity, and a responsive layout. What we don’t have is a way to search for things, even in a user testing sense. Once again, Bootstrap has us covered.

Users are accustomed to the search box being prominently displayed in the top right corner of desktop displays, and just below the headline on narrower displays. We will begin by breaking the header element into two blocks, and adding a single input to the smaller:

We will also add a few lines of CSS to the user.css file, to push the search box off the top of the page.

We will also be writing a slightly larger amount of JavaScript to make the typeahead work properly. I will keep it to a minimum, and explain what each script is doing.

I imagine some of you are thinking “I am a web designer, not a developer. Fair point, but we have to at least test the JavaScript waters to unlock Bootstrap’s full power. And besides: clients are wowed when an input box starts returning results from the first letter they type.

Add the JavaScript snippet below to your existing script tag, and hit Refresh. If it works correctly, you should see a dropdown menu with suggested results after you have typed one or more letters in the search box.

Okay, here's what the code is doing. The var search = $('input#search') tells jQuery to store a reference to the search box in the named variable search. Then we call, or invoke, the jQuery function on our search variable, and also call the Bootstrap typeahead method. Inside the typeahead parenthesis, you will notice an opening and closing squiggly bracket { }. These brackets are used to create a JavaScript object, and store some information about our search box.

The first piece of information is the source array. At its simplest, an array is an ordered list of things. Here it is a list of guitar players. Every guitar player added to the array will be available as a result in our search input. The second part of the object, items: 5 tells the search box the maximum number of results to show.

These are just two of several options available. I encourage you to look at the Bootstrap typeahead documentation and experiment with different configurations. The final screen for this step should look similar to this:

Basic search typeahead functionality


Bootstrap has become a staple in my front–end workflow. It allows me to test when iterations are relatively painless, and try several different approaches concurrently. These discoveries help guide final design decisions, and help avoid time-consuming changes during the full development cycle. By treating wireframes as a critical part of the user experience, I am able to build tools that feel more natural and are more gratifying.

I have just scratched the surface of Bootstrap, and what is possible using its kit of parts. Wireframes are a great place to start learning the ins and outs—they are meant to be lo-fi, early test models of full applications to come. Clients and colleagues can test our assumptions, and help us refine quickly, with minimal time lost.

I hope you liked this tutorial, thanks for reading!