{"id":272834,"date":"2018-07-05T07:04:40","date_gmt":"2018-07-05T14:04:40","guid":{"rendered":"http:\/\/css-tricks.com\/?p=272834"},"modified":"2018-07-05T08:01:35","modified_gmt":"2018-07-05T15:01:35","slug":"prototyping-in-the-browser","status":"publish","type":"post","link":"https:\/\/css-tricks.com\/prototyping-in-the-browser\/","title":{"rendered":"Prototyping in the Browser"},"content":{"rendered":"

Prototyping animations and interactions is vital for a number of reasons: they can make your interface feel deceptively fast, they can help focus the user on a specific task, and they can provide a better sense of the current state of your application. Is data being loaded? Is something now unclickable? How long do they have to wait until they can perform an action?<\/p>\n

<\/p>\n

At Gusto<\/a>, I\u2019ve been working on a lot of tiny interaction details and prototypes lately for these very reasons — sadly there\u2019s not much that I can show you all in detail just yet. But, I think the process<\/em> of how I\u2019m doing this is far more interesting than what I\u2019m actually working on so that’s what I’m going to share here.<\/p>\n

The problem I\u2019ve faced with prototyping animations comes down to the tools because they ultimately feel restrictive to me. Whenever I\u2019ve experimented with them in the past, I feel like one hand is always tied behind my back. It could very well be that I\u2019m not using them correctly, but I feel that none of them really mimic browser behavior quite right and, although I\u2019ve been fascinated to watch tools like Framer<\/a>, Marvel<\/a>, Zeplin<\/a> and Principle<\/a> gain traction, I don\u2019t think they\u2019re for me. At least not yet anyway.<\/p>\n

In my opinion, the best way to prototype a lot of interactions is still with plain ol\u2019 HTML, CSS and (gasp!) a sprinkle of jQuery when I need it.<\/p>\n

How I\u2019m prototyping today<\/h3>\n

With my recent project, I decided to invest a little bit of time into CodePen to help our design team quickly prototype things. Here\u2019s what I built: <\/p>\n

See the Pen Gusto Prototype: Header<\/a> by Robin Rendle (@robinrendle<\/a>) on CodePen<\/a>.<\/p>\n

No really, that\u2019s it. It\u2019s just a simple prototype that looks like our app.<\/p>\n

It\u2019s a pen with all the HTML for the app navigation — and it contains all the CSS, too. This way, a designer at Gusto can fork that pen and start writing HTML and CSS to experiment with a specific bit of UI<\/abbr> without all the added pressure of having to write production code. It\u2019s important to note that this prototype isn\u2019t for figuring out UX<\/abbr>, as tools like Figma<\/a> and Sketch<\/a> do a much better job of that. Prototypes like this are mostly useful when figuring out finicky UI interactions like tables, spreadsheets and dropdowns — components that can get complicated real quick. <\/p>\n

To make this prototype, I simply copied and pasted all of the HTML and CSS from our web app into a new pen. (In the future, we should probably have a system where we\u2019re always prototyping with the latest up-to-date code from our app but, for now, I think this is a fine starting point.) This pen contains all of the menu and navigation items we need to make it look like the Gusto app. We have a a separate pen for the footer which closes off all the divs that we open up in the header. Lastly, we have one more pen that imports those two other pens like so:<\/p>\n

<!-- HEADER -->\r\n[[[http:\/\/codepen.io\/robinrendle\/pen\/481a88853820067752e28cdb479c91f3]]]\r\n\r\n<!-- HTML GOES HERE -->\r\n<h1>App Prototype<\/h1>\r\n<p>You can fork this pen and write all the HTML and CSS you need to prototype interactions and explore ideas right here in your browser.<\/p>\r\n\r\n<!-- FOOTER -->\r\n[[[http:\/\/codepen.io\/robinrendle\/pen\/0dcaa93954f06f4d03b7e23e8ea54cac]]]<\/code><\/pre>\n

See the Pen Gusto Prototype: Full<\/a> by Robin Rendle (@robinrendle<\/a>) on CodePen<\/a>.<\/p>\n

What\u2019s that weird syntax with all the [[[ ]]]<\/code>? That\u2019s the HTML Include syntax<\/a> for CodePen. If we put the URL of a pen in between those brackets, CodePen will fetch the code from that pen and place it straight into this new pen. That\u2019s it! Pretty sweet, right?<\/p>\n

To wrap things up, I wanted to make a couple of notes about what I\u2019ve learned with this new setup.<\/p>\n

Lesson 1: Prototypes should be super easy to share<\/h3>\n

Ideally, prototypes are easy to share with other designers and engineers, exceptionally fast to get setup, and don\u2019t require prior training or expertise — and Codepen is perfect for that. I like this setup for a bunch of reasons. For one, we don\u2019t have to teach designers CoffeeScript like we have to with Framer and we don\u2019t have to run React or Vue workshops to get them up and running with a complex prototyping app.<\/p>\n

Yes, folks do need to learn how HTML and CSS works to make prototypes like this but I think learning the very basics of those two languages is vital for a designer working on the web anyway.<\/p>\n

Lesson 2: Bad code is a-okay<\/h3>\n

Here\u2019s another thing I recently learned while doing prototyping: bad code is okay<\/strong> at this stage. In fact, we should<\/em> be writing terrible, unforgivable code when prototyping in the browser. We ought to write the sort of CSS and HTML that would keep Harry Roberts up at night because clean, maintainable code gets in the way of the design process when the focus should be on iterating as quickly as possible.<\/p>\n

To be quite honest, I don\u2019t care about front-end best practices when I\u2019m making these prototypes — I don\u2019t think about BEM, semantic HTML or even performance. Oh, and I certainly don\u2019t care about the most proficient way to render a React thingamijig.<\/p>\n

As long as we ditch all of that prototype code and start from scratch later, and as long as there\u2019s step to break the design into components and ensure that those lego pieces are maintainable, well documented, and highly performant in our production environment, then I believe that writing bad should not only be allowed, but actively encouraged.<\/p>\n

This leads to my final takeaway.<\/p>\n

Lesson 3: Designers and developers should always translate their code<\/h3>\n

I reckon that the first time a designer and\/or front-end developer writes code, it should never be in a production environment. Having the leeway and freedom to go crazy with the code in a safe environment focuses your attention on the design and making it compatible with a browser\u2019s constraints. After this, you can think about grooming the code from a hot, steaming heap of garbage into lovely, squeaky-clean, production-ready poetry. Translating the static mockups into an interactive prototype is the first step, but it\u2019s vital to have a next step to enforce your code standards. <\/p>\n

Does your app use BEM? How should you abstract each of these components into separate files? What do you call all of these new components that you\u2019re introducing into the design system? <\/p>\n

I believe all of these questions are easier to answer once you have that interactive prototype. And I would highly recommend that designers and front-end engineers alike experiment making little tools like this. It might feel a little odd at first, but I promise that it will produce much better work in the long run.<\/p>\n","protected":false},"excerpt":{"rendered":"

Prototyping animations and interactions is vital for a number of reasons: they can make your interface feel deceptively fast, they can help focus the user on a specific task, and they can provide a better sense of the current state of your application. Is data being loaded? Is something now unclickable? How long do they […]<\/p>\n","protected":false},"author":223806,"featured_media":273264,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"sig_custom_text":"","sig_image_type":"featured-image","sig_custom_image":0,"sig_is_disabled":false,"inline_featured_image":false,"c2c_always_allow_admin_comments":false,"footnotes":"","jetpack_publicize_message":"Mr. @robinrendle with some sage advice on what he's learned from prototyping a recent project.","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":[]},"categories":[4],"tags":[605,844,1347],"jetpack_publicize_connections":[],"acf":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2018\/06\/tetris-blocks.png?fit=1200%2C600&ssl=1","jetpack-related-posts":[],"featured_media_src_url":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2018\/06\/tetris-blocks.png?fit=1024%2C512&ssl=1","_links":{"self":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/posts\/272834"}],"collection":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/users\/223806"}],"replies":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/comments?post=272834"}],"version-history":[{"count":8,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/posts\/272834\/revisions"}],"predecessor-version":[{"id":273661,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/posts\/272834\/revisions\/273661"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/media\/273264"}],"wp:attachment":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/media?parent=272834"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/categories?post=272834"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/tags?post=272834"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}