{"database": "24ways", "table": "articles", "rows": [[58, "Beyond the Style Guide", "Much like baking a Christmas cake, designing for the web involves creating an experience in layers. Starting with a solid base that provides the core experience (the fruit cake), we can add further layers, each adding refinement (the marzipan) and delight (the icing).\nDon\u2019t worry, this isn\u2019t a misplaced cake recipe, but an evaluation of modular design and the role style guides can play in acknowledging these different concerns, be they presentational or programmatic.\nThe auteur\u2019s style guide\nAlthough trained as a graphic designer, it was only when I encountered the immediacy of the web that I felt truly empowered as a designer. Given a desire to control every aspect of the resulting experience, I slowly adopted the role of an auteur, exploring every part of the web stack: front-end to back-end, and everything in between. A few years ago, I dreaded using the command line. Today, the terminal is a permanent feature in my Dock.\nIn straddling the realms of graphic design and programming, it\u2019s the point at which they meet that I find most fascinating, with each dicipline valuing the creation of effective systems, be they for communication or code efficiency. Front-end style guides live at this intersection, demonstrating both the modularity of code and the application of visual design.\nPainting by numbers\nIn our rush to build modular systems, design frameworks have grown in popularity. While enabling quick assembly, these come at the cost of originality and creative expression \u2013 perhaps one reason why we\u2019re seeing the homogenisation of web design.\nIn editorial design, layouts should accentuate content and present it in an engaging manner. Yet on the web we see a practice that seeks templated predictability. In \u2018Design Machines\u2019 Travis Gertz argued that (emphasis added):\n\nDesign systems still feel like a novelty in screen-based design. We nerd out over grid systems and modular scales and obsess over style guides and pattern libraries. We\u2019re pretty good at using them to build repeatable components and site-wide standards, but that\u2019s sort of where it ends. [\u2026] But to stop there is to ignore the true purpose and potential of a design system.\n\nUnless we consider how interface patterns fully embrace the design systems they should be built upon, style guides may exacerbate this paint-by-numbers approach, encouraging conformance and suppressing creativity.\nAnatomy of a button\nLet\u2019s take a look at that most canonical of components, the button, and consider what we might wish to document and demonstrate in a style guide.\nThe different layers of our button component.\nContent\nThe most variable aspect of any component. Content guidelines will exert the most influence here, dictating things like tone of voice (whether we should we use stiff, formal language like \u2018Submit form\u2019, or adopt a more friendly tone, perhaps \u2018Send us your message\u2019) and appropriate language. For an internationalised interface, this may also impact word length and text direction or orientation.\nStructure\nHTML provides a limited vocabulary which we can use to structure content and add meaning. For interactive elements, the choice of element can also affect its behaviour, such as whether a button submits form data or links to another page:\n<button type=\"submit\">Button text</button>\n<a href=\"/index.html\">Button text</a>\nNote: One of the reasons I prefer to use <button> instead of <input type=\u201cbutton\u201d>, besides allowing the inclusion of content other than text, is that it has a markup structure similar to links, therefore keeping implementation differences to a minimum.\nWe should also think about each component within the broader scope of our particular product. For this we can employ a further vocabulary, which can be expressed by adding values to the class attribute. For a newspaper, we might use names like lede, standfirst and headline, while a social media application might see us reach for words like stream, action or avatar.\nPresentation\nThe appearance of a component can never be considered in isolation. Informed by its relationship to other elements, style guides may document different stylistic variations of a component, even if the underlying function remains unchanged: primary and secondary button styles, for example.\nBehaviour\nA component can exhibit various states: blank, loading, partial, error and ideal, and a style guide should reflect that. Our button component is relatively simple, yet even here we need to consider hover, focused, active and disabled states.\nTranscending layers\nThis overview reinforces Ethan\u2019s note from earlier in this series:\n\nI\u2019ve found that thinking about my design as existing in broad experience tiers \u2013 in layers \u2013 is one of the best ways of designing for the modern web.\n\nWhile it\u2019s tempting to describe a component as series of layers, certain aspects will transcend several of these. The accessibility of a component, for example, may influence the choice of language, the legibility of text, colour contrast and which affordances are provided in different states.\nVisual design language: documenting the missing piece\nEven given this small, self-contained component, we can see several concerns at play, and in reviewing our button it seems we have most things covered. However, a few questions remain unanswered. Why does it have a blue background? Why are the borders 2px thick, with a radius of 4px? Why are we using that font, at that size and with that weight?\nThese questions can be answered by our visual design language. More than a set of type choices and colour palettes, a design language can dicate common measures, ratios and the resulting grid(s) these influence. Ideally governed by a set of broader design principles, it can also inform an illustration style, the type of photography sourced or commissioned, and the behaviour of any animations.\nWhereas a style guide ensures conformity, having it underpinned by an effective design language will allow for flexibility; only by knowing the rules can you know how to break them!\nType pairings in the US Web Design Standards guide.\nFor a style guide to thoroughly articulate a visual design system, the spectrum of choices it allows for should be acknowledged. A fantastic example of this can be found in the US Web Design Standards. By virtue of being a set of standards designed to apply to a number of different sites, this guide offers a range of type pairings (that take into account performance considerations) and provides primary, secondary and tertiary palette relationships, with shades and tones thereof:\nColour palettes in the US Web Design Standards guide.\nA visual language in code form\nProperly documenting our design language in a style guide is a good start, yet even better if it can be expressed in code. This is where CSS preprocessors become a powerful ally.\nIn Sass, methods like mixins and maps can help us represent relationships between values. Variables (and CSS variables) extend the vocabulary provided natively by CSS, meaning we can describe patterns in terms of our own visual language. These tools effectively become an interface to our design system. Furthermore, they help maintain a separation of concerns, with visual presentation remaining where it should be: in our style sheets.\nTake this simple example, an article summary on a website counting down the best Christmas movies:\nThe design for our simple component example.\nOur markup is as follows, using appropriate semantic HTML elements and incorporating the vocabulary from our collection of design patterns (expressed using the BEM methodology):\n<article class=\"summary\">\n    <h1 class=\"summary__title\">\n        <a href=\"scrooged.html\">\n            <span class=\"summary__position\">12</span>\n            Scrooged (1988)\n        </a>\n    </h1>\n\n    <div class=\"summary__body\">\n        <p>It\u2019s unlikely that Bill Murray could ever have got through his career without playing a version of Scrooge\u2026</p>\n    </div>\n\n    <footer class=\"summary__meta\">\n        <strong>Director:</strong> Richard Donner<br/>\n        <strong>Stars:</strong> Bill Murray, Buddy Hackett, Karen Allen\n    </footer>\n</article>\nWe can then describe the presentation of this HTML by using Sass maps to define our palettes, mixins to include predefined font metrics, and variables to recall common measurements:\n.summary {\n    margin-bottom: ($baseline * 4)\n}\n\n.summary__title {\n    @include font-family(display-serif);\n    @include font-size(title);\n    color: palette(neutral, dark);\n    margin-bottom: ($baseline * 4);\n    border-top: $rule-height solid palette(primary, purple);\n    padding-top: ($baseline * 2);\n}\n\n.summary__position {\n    @include font-family(display-sans, 300);\n    color: palette(neutral, mid);\n}\n\n.summary__body {\n    @include font-family(text-serif);\n    @include font-size(body);\n    margin-bottom: ($baseline * 2);\n}\n\n.summary__meta {\n    @include font-family(text-sans);\n    @include font-size(caption);\n}\nOf course, this is a simplistic example for the purposes of demonstration. However, such thinking was employed at a much larger scale at the Guardian. Using a set of Sass components, complex patterns could be described using a language familar to everyone on the product team, be they a designer, developer or product owner:\nThe design of a component on the Guardian website, described in terms of its Sass-powered design system.\nUnlocking possibility\nAlongside tools like preprocessors, newer CSS layout modules like flexbox and grid layout mean the friction we\u2019ve long been accustomed to when creating layouts on the web is no longer present, and the full separation of presentation from markup is now possible. Now is the perfect time for graphic designers to advocate design systems that these developments empower, and ensure they\u2019re fully represented in both documentation and code. That way, together, we can build systems that allow for greater visual expression. After all, there\u2019s more than one way to bake a Christmas cake.", "2015", "Paul Lloyd", "paulrobertlloyd", "2015-12-16T00:00:00+00:00", "https://24ways.org/2015/beyond-the-style-guide/", "design"]], "columns": ["rowid", "title", "contents", "year", "author", "author_slug", "published", "url", "topic"], "primary_keys": ["rowid"], "primary_key_values": ["58"], "units": {}, "query_ms": 0.44798851013183594}