<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: AREA 17</title>
    <description>The latest articles on Forem by AREA 17 (@area17).</description>
    <link>https://forem.com/area17</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Forganization%2Fprofile_image%2F4811%2F05300171-d2c6-4ee2-b6be-51ac636bc2bb.jpg</url>
      <title>Forem: AREA 17</title>
      <link>https://forem.com/area17</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/area17"/>
    <language>en</language>
    <item>
      <title>Auto-visualizing Tailwind Tokens and Documenting Design Systems Props with Blast</title>
      <dc:creator>Tim Brook</dc:creator>
      <pubDate>Wed, 05 Jan 2022 15:50:03 +0000</pubDate>
      <link>https://forem.com/area17/documenting-your-design-system-in-blast-4ao6</link>
      <guid>https://forem.com/area17/documenting-your-design-system-in-blast-4ao6</guid>
      <description>&lt;p&gt;We've recently added some new features to &lt;a href="https://github.com/area17/blast" rel="noopener noreferrer"&gt;Blast&lt;/a&gt; to help document your design system. In Blast 1.4, one of our community members submitted an update to enable Storybook's extended documentation for component props and in Blast 1.5 we added the ability to automatically generate stories to visualize your Tailwind configuration. &lt;/p&gt;

&lt;p&gt;The auto-generated stories are built in a way that allows you to configure which areas of your Tailwind config is generated and then, because the stories are published to your Laravel application, you can extend them with additional notes. &lt;/p&gt;

&lt;p&gt;In this guide I'll walk you through the new features and show how to take your design system from no documentation to fully documented and use some of Blast's features to streamline adding documentation to your components.&lt;/p&gt;

&lt;p&gt;If you're new to Blast consider reading &lt;a href="https://dev.to/area17/getting-started-with-blast-storybook-for-laravel-blade-c5c"&gt;our other guide&lt;/a&gt; which introduces you to Blast and guides you through the initial setup and features.&lt;/p&gt;

&lt;h2&gt;
  
  
  What does it do and why do I need it?
&lt;/h2&gt;

&lt;p&gt;Documentation is a crucial part of any design system. It guides every single team member on how to use and extend the system.&lt;/p&gt;

&lt;p&gt;At AREA 17, whenever we create a Storybook for clients, we like to include as much documentation for the design tokens as possible, from colors, to the layout grid, spacing tokens, breakpoints, etc. There isn't an out-of-the-box way to do this with Storybook so we have to manually create components to handle this. &lt;/p&gt;

&lt;p&gt;As of Blast 1.5, this process is no longer manual. We can run one task and it parses our Tailwind config and generates the stories needed to visualize all of the system's design tokens. Out of the box it supports the main Tailwind core elements as well as &lt;a href="https://github.com/area17/tailwind-plugins" rel="noopener noreferrer"&gt;some of our own plugins &lt;/a&gt; we developed to make developing column based layouts, type sets, etc easier with Tailwind.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to Auto Generate Documentation
&lt;/h2&gt;

&lt;p&gt;Before you can run the command to create the documentation stories you need to set the location of the &lt;code&gt;tailwind.config.js&lt;/code&gt; in your application's &lt;code&gt;config/blast.php&lt;/code&gt;. Look for the &lt;code&gt;tailwind_config_path&lt;/code&gt; item and check that the path is correct, it defaults to the project root. &lt;/p&gt;

&lt;p&gt;Now that you've confirmed the location of our Tailwind config file you can run the following command from your Laravel application directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan blast:generate-docs
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You'll be prompted to give your documentation section a name. Enter a name or hit &lt;code&gt;return&lt;/code&gt; to use the default 'UI Documentation' name. If stories already exist in that location you will be prompted to override them.&lt;/p&gt;

&lt;p&gt;Blast will now parse your Tailwind config, copy the story blade files to your application, generate the stories and update the Storybook UI. Once complete, your Storybook should look something like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fii97uvtg39ankt4oqge2.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fii97uvtg39ankt4oqge2.gif" alt="An animated gif showing the Border Radius and Color documentation pages from Blast's Storybook UI"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click through the items in the sidebar to see each section of your Tailwind config visualized. Some of the sections like Color and Transitions have Storybook controls so you can interact with the stories and filter background colors or change transition properties. &lt;/p&gt;

&lt;h2&gt;
  
  
  Configuring Auto-documentation
&lt;/h2&gt;

&lt;p&gt;There may be times when you don't want to generate documentation for every part of your Tailwind config, you just want to show the colors or spacing values. You can do this by adding/removing items from the &lt;code&gt;auto_documentation&lt;/code&gt; item in your application's &lt;code&gt;config/blast.php&lt;/code&gt;. All of the content types are enabled by default, these are:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;border-radius
border-width
colors
font-size
font-weight
height
layout (requires a17-tailwind-plugins)
letter-spacing
line-height
max-height
max-width
min-height
min-width
opacity
shadows
spacing
transition
typesets (requires a17-tailwind-plugins)
width
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Extending the Stories
&lt;/h2&gt;

&lt;p&gt;As these documentation stories are published to your application and are built in the same format as all of your other stories, you are free to edit them as you wish. &lt;/p&gt;

&lt;p&gt;By default they use the &lt;code&gt;DocsPage&lt;/code&gt; component shipped with Blast along with the component used to visualize the Tailwind config within it.&lt;/p&gt;

&lt;p&gt;You can add notes around the inner components to give further context to your design tokens, add a &lt;code&gt;README.md&lt;/code&gt; to the UI Docs story directory to add documentation to the Docs tab in the Storybook UI, use the &lt;code&gt;@storybook&lt;/code&gt; directive to create controls. Anything you can do in your component stories, is available to you in these documentation stories.&lt;/p&gt;

&lt;h3&gt;
  
  
  But that's not all...
&lt;/h3&gt;

&lt;p&gt;All of the data from your parsed Tailwind config is stored in what we call the &lt;code&gt;UIDataStore&lt;/code&gt;. This is available within your stories (we use it in the Transitions stories - see &lt;code&gt;views/stories/data/ui-docs.php&lt;/code&gt;) so if you need to visualize something that Blast doesn't support, the data is already there for you to create a component and visualize it. &lt;/p&gt;

&lt;p&gt;If you find yourself using this feature to create stories for plugins or other Tailwind features Blast doesn't currently support, please submit a PR to Blast so we can include it!&lt;/p&gt;

&lt;h2&gt;
  
  
  Updating Data
&lt;/h2&gt;

&lt;p&gt;If you've created your UI Documentation and then changed something in your Tailwind config, you'll need to update the data for the stories. If you run &lt;code&gt;php artisan blast:generate-docs&lt;/code&gt; you will be prompted to override the current stories which we may not always want to do.&lt;/p&gt;

&lt;p&gt;In this case you can use the &lt;code&gt;--update-data&lt;/code&gt; option and this will re-parse your Tailwind config, skip the copying stage and regenerate the stories.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan blast:generate-docs &lt;span class="nt"&gt;--update-data&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Documenting Component Props
&lt;/h2&gt;

&lt;p&gt;As of Blast 1.4 you have been able to add more detailed documentation to component props using &lt;a href="https://storybook.js.org/docs/react/essentials/controls#show-full-documentation-for-each-property" rel="noopener noreferrer"&gt;Storybook's expanded controls&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This allows you to add a description and the default default value to your controls table which appears beneath your component canvas and also on the Docs page.&lt;/p&gt;

&lt;p&gt;This feature is enabled by default but should you need to disable it, you can do so by setting &lt;code&gt;storybook_expanded_controls&lt;/code&gt; to false in &lt;code&gt;config/blast.php&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;You can define this additional documentation in the &lt;code&gt;argTypes&lt;/code&gt; array within the &lt;code&gt;@storybook&lt;/code&gt; directive in your story blade files. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="nf"&gt;storybook&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
    &lt;span class="s1"&gt;'args'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="s1"&gt;'label'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'Label'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s1"&gt;'href'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt;
    &lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="s1"&gt;'argTypes'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="s1"&gt;'label'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
            &lt;span class="s1"&gt;'description'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'Plain text used within the button'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s1"&gt;'defaultValue'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'summary'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
        &lt;span class="p"&gt;],&lt;/span&gt;
        &lt;span class="s1"&gt;'href'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
            &lt;span class="s1"&gt;'description'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'The `href` string to use on an `a` element. If this prop is set to `falsey` value the component will render as a `button`.'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s1"&gt;'defaultValue'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'summary'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
        &lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;will render as the following in your component's 'Controls' tab:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhicf8p6ghhhmfq0p8k7f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhicf8p6ghhhmfq0p8k7f.png" alt="a screenshot of the Storybook controls tab displaying a label a href prop and their documentation"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Reusing Prop Documentation
&lt;/h3&gt;

&lt;p&gt;You can also define this documentation in a &lt;code&gt;data/[something].php&lt;/code&gt; file and use it across multiple components via the &lt;code&gt;preset&lt;/code&gt; data in the &lt;code&gt;@storybook&lt;/code&gt; directive. &lt;/p&gt;

&lt;p&gt;For example, if you have &lt;code&gt;primary&lt;/code&gt; and &lt;code&gt;secondary&lt;/code&gt; button components which both share the same props you can create a &lt;code&gt;stories/data/button.php&lt;/code&gt; file containing the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="s1"&gt;'base'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="s1"&gt;'args'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
            &lt;span class="s1"&gt;'label'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'Label'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s1"&gt;'href'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt;
        &lt;span class="p"&gt;],&lt;/span&gt;
        &lt;span class="s1"&gt;'argTypes'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
            &lt;span class="s1"&gt;'label'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
                &lt;span class="s1"&gt;'description'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'Plain text used within the button'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="s1"&gt;'defaultValue'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'summary'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
            &lt;span class="p"&gt;],&lt;/span&gt;
            &lt;span class="s1"&gt;'href'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
                &lt;span class="s1"&gt;'description'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'The `href` string to use on an `a` element. If this prop is set to `falsey` value the component will render as a `button`.'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="s1"&gt;'defaultValue'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'summary'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
            &lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and then in your story blade files you can use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="c1"&gt;// stories/button/primary.blade.php&lt;/span&gt;
&lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="nf"&gt;storybook&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
    &lt;span class="s1"&gt;'preset'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'button.base'&lt;/span&gt;
&lt;span class="p"&gt;])&lt;/span&gt;

&lt;span class="c1"&gt;// stories/button/secondary.blade.php&lt;/span&gt;
&lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="nf"&gt;storybook&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
    &lt;span class="s1"&gt;'preset'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'button.base'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'args'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="s1"&gt;'label'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'Secondary'&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will reuse everything from the preset and allow you to override anything within from your story blade file.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;That covers all of the latest documentation features in Blast. The folks over at Storybook also wrote &lt;a href="https://storybook.js.org/blog/4-ways-to-document-your-design-system-with-storybook/" rel="noopener noreferrer"&gt;an awesome article about writing documentation in Storybook&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;We're working on adding support for more frameworks to the auto-documention feature, Storybook 6.4 support, more customization options, and lots of other new features so watch this space.&lt;/p&gt;

&lt;p&gt;If you have any questions or ideas, please head over to our &lt;a href="https://github.com/area17/blast" rel="noopener noreferrer"&gt;Github&lt;/a&gt; and submit Issues, PRs, etc or join the &lt;a href="https://discord.com/invite/cnWk7EFv8R" rel="noopener noreferrer"&gt;Twill CMS Discord&lt;/a&gt; and head to the Blast channel. &lt;/p&gt;

</description>
      <category>laravel</category>
      <category>storybook</category>
      <category>tailwindcss</category>
      <category>opensource</category>
    </item>
    <item>
      <title>Getting Started with Blast – Storybook for Laravel Blade</title>
      <dc:creator>Tim Brook</dc:creator>
      <pubDate>Mon, 18 Oct 2021 14:08:33 +0000</pubDate>
      <link>https://forem.com/area17/getting-started-with-blast-storybook-for-laravel-blade-c5c</link>
      <guid>https://forem.com/area17/getting-started-with-blast-storybook-for-laravel-blade-c5c</guid>
      <description>&lt;p&gt;In this guide we'll show you how to set up a component library within your Laravel app using &lt;a href="https://github.com/area17/blast"&gt;Blast&lt;/a&gt;. &lt;/p&gt;

&lt;h2&gt;
  
  
  First of all, what is Blast?
&lt;/h2&gt;

&lt;p&gt;At AREA 17, we've been using &lt;a href="https://storybook.js.org/"&gt;Storybook&lt;/a&gt; for many years with both &lt;a href="https://vuejs.org/"&gt;Vue&lt;/a&gt; and &lt;a href="https://reactjs.org/"&gt;React&lt;/a&gt; and we love it, but our core technology is &lt;a href="https://laravel.com/"&gt;Laravel&lt;/a&gt;, and we want to be able to work with Storybook in that environment too. We've been able to in the past using the Twig loader, but our heart is closer to Blade. When Quentin, our Engineering Group Director, realized Storybook Server was a thing, and what the &lt;a href="https://orbit.love/blog/building-a-component-library-in-rails-with-storybook"&gt;Rails community was able to do with it&lt;/a&gt;, he started to dream big and threw a quick prototype at it. We then worked together to make that prototype a reality and it became &lt;strong&gt;&lt;a href="https://github.com/area17/blast"&gt;Blast – Storybook for Laravel Blade&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Blast is a Laravel package which allows you render examples of your app's components using the Blade templating engine and Storybook Server within your Laravel application. It's designed to be low maintenance and simple to set up whilst offering a solid set of features and customizations. Blast can be used with new or existing Laravel projects - we timed it and it took less than 90s to install into an existing project and have our first component rendering in Storybook!&lt;/p&gt;

&lt;p&gt;It comes with a lot of the tools we use at AREA 17 like the Controls, Accessibility testing and Design tabs as well as statuses and a page component for more global things like documentation.&lt;/p&gt;

&lt;p&gt;Now that the introduction is over, let's get started!&lt;/p&gt;

&lt;h2&gt;
  
  
  Installation
&lt;/h2&gt;

&lt;p&gt;You can get started by installing Blast using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;composer require area17/blast
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a &lt;code&gt;stories&lt;/code&gt; and a &lt;code&gt;data&lt;/code&gt; directory for your story Blade files and any associated data&lt;/li&gt;
&lt;li&gt;Publish assets used by Blast to the application's public directory&lt;/li&gt;
&lt;li&gt;Create a route from which to load your component examples&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Blast ships with 4 tasks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;blast:launch&lt;/code&gt; - installs all dependencies, generates stories, watches directories and fires up Storybook Server&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;blast:generate-stories&lt;/code&gt; - can be used to regenerate the stories.json files for each component outside of the &lt;code&gt;blast:launch&lt;/code&gt; task&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;blast:demo&lt;/code&gt; - creates a demo button component to help get you started&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;blast:publish&lt;/code&gt; - generates a static Storybook instance and publishes it to your application's public directory&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;More information can be found about those tasks in the &lt;a href="https://github.com/area17/blast#readme"&gt;official documentation&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating Stories
&lt;/h2&gt;

&lt;p&gt;Once you've installed Blast you can launch it by running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan blast:launch
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For this demo we'll create a basic button component and stories.&lt;/p&gt;

&lt;h3&gt;
  
  
  Setup Components
&lt;/h3&gt;

&lt;p&gt;For this guide we're going to need some basic components. We're going to need a &lt;code&gt;button&lt;/code&gt;, &lt;code&gt;button-box&lt;/code&gt; and some icons. You can find everything you'll need &lt;a href="https://github.com/mrtimbrook/blast-guide-components"&gt;in this repo&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;When you're done, your &lt;code&gt;components&lt;/code&gt; directory should now look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;resources/views/components/
├── button/
│   └── primary.blade.php
├── button-box/
│   └── primary.blade.php
└── icon/
    ├── help-24.blade.php
    ├── menu-24.blade.php
    └── plus-24.blade.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Create a Story
&lt;/h3&gt;

&lt;p&gt;Time to create your first story! When initially launching Blast, it created the directories to store your story blade files in &lt;code&gt;resources/views/stories&lt;/code&gt; so, inside that directory, create &lt;code&gt;button/primary.blade.php&lt;/code&gt; containing the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;x-button.primary&amp;gt;&lt;/span&gt;
    Primary Button
&lt;span class="nt"&gt;&amp;lt;/x-button.primary&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Hit save and Blast will automatically generate the stories for the component and reload storybook in your browser. Go check it out. Pretty cool huh? Maybe, but it's fairly basic and doesn't show what our button is capable of.&lt;/p&gt;

&lt;h3&gt;
  
  
  Adding args
&lt;/h3&gt;

&lt;p&gt;Let's create some Storybook controls to set the button label, icon and icon position.&lt;/p&gt;

&lt;p&gt;Blast uses a &lt;code&gt;@storybook&lt;/code&gt; directive to customize your story. You can read more about the options in the &lt;a href="https://github.com/area17/blast#readme"&gt;Blast docs&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Enter the following at the top of your &lt;code&gt;stories/button/primary.blade.php&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="nf"&gt;storybook&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
    &lt;span class="s1"&gt;'args'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="s1"&gt;'label'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'Button'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s1"&gt;'href'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'#'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s1"&gt;'icon'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'menu-24'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s1"&gt;'iconPosition'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'after'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Everything within the &lt;code&gt;args&lt;/code&gt; array becomes a variable that you can reference within the same story blade file.&lt;/p&gt;

&lt;p&gt;Update the component beneath the &lt;code&gt;@storybook&lt;/code&gt; directive with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;x-button.primary&lt;/span&gt;
    &lt;span class="na"&gt;:href=&lt;/span&gt;&lt;span class="s"&gt;"$href ?? null"&lt;/span&gt;
    &lt;span class="na"&gt;:icon=&lt;/span&gt;&lt;span class="s"&gt;"$icon ?? null"&lt;/span&gt;
    &lt;span class="na"&gt;:iconPosition=&lt;/span&gt;&lt;span class="s"&gt;"$iconPosition ?? null"&lt;/span&gt;
&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    {{ $label ?? null }}
&lt;span class="nt"&gt;&amp;lt;/x-button.primary&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Blast will automatically regenerate the story and reload Storybook. The 'Controls' panel beneath your component will now contain text fields to edit all of the &lt;code&gt;args&lt;/code&gt; and update the component view.&lt;/p&gt;

&lt;h3&gt;
  
  
  Introducing &lt;code&gt;argTypes&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Being able to edit some of the fields with a text field is great, but using a text field for things like icons or the icon position is a bit of a pain so let's fix that by setting some &lt;code&gt;argTypes&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;argTypes&lt;/code&gt; allow us to further configure the control for each of the &lt;code&gt;args&lt;/code&gt;. You can read more about &lt;code&gt;argTypes&lt;/code&gt; and the available options in the &lt;a href="https://storybook.js.org/docs/react/essentials/controls"&gt;official Storybook docs&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Update the &lt;code&gt;@storybook&lt;/code&gt; in your &lt;code&gt;primary.blade.php&lt;/code&gt; to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="nf"&gt;storybook&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
    &lt;span class="s1"&gt;'args'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="s1"&gt;'label'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'Button'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s1"&gt;'href'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'#'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s1"&gt;'icon'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'menu-24'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s1"&gt;'iconPosition'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'after'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="s1"&gt;'argTypes'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="s1"&gt;'iconPosition'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;
            &lt;span class="s1"&gt;'options'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
                &lt;span class="s1"&gt;'before'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'after'&lt;/span&gt;
            &lt;span class="p"&gt;],&lt;/span&gt;
            &lt;span class="s1"&gt;'control'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
                &lt;span class="s1"&gt;'type'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'radio'&lt;/span&gt;
            &lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="p"&gt;],&lt;/span&gt;
        &lt;span class="s1"&gt;'icon'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;
            &lt;span class="s1"&gt;'options'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
                &lt;span class="s1"&gt;'help-24'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'menu-24'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'plus-24'&lt;/span&gt;
            &lt;span class="p"&gt;],&lt;/span&gt;
            &lt;span class="s1"&gt;'control'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
                &lt;span class="s1"&gt;'type'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'select'&lt;/span&gt;

            &lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will update the &lt;code&gt;iconPosition&lt;/code&gt; fild to use &lt;code&gt;radio&lt;/code&gt; buttons for the 'before' and 'after' options as well as updating the &lt;code&gt;icon&lt;/code&gt; field to use a &lt;code&gt;select&lt;/code&gt;. Much better!&lt;/p&gt;

&lt;h3&gt;
  
  
  Rename the story
&lt;/h3&gt;

&lt;p&gt;Blast uses the filename to create the story name. This could be fine for most of our components but sometimes we want to give our story a more descriptive name.&lt;/p&gt;

&lt;p&gt;We can do that with the &lt;code&gt;name&lt;/code&gt; parameter in our &lt;code&gt;@storybook&lt;/code&gt; directive.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="nf"&gt;storybook&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
    &lt;span class="s1"&gt;'name'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'Button with Icon'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="mf"&gt;...&lt;/span&gt;
&lt;span class="p"&gt;])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Storybook should now be showing the updated name in the sidebar.&lt;/p&gt;

&lt;h3&gt;
  
  
  Setting a status
&lt;/h3&gt;

&lt;p&gt;Blast ships with the &lt;a href="https://storybook.js.org/addons/@etchteam/storybook-addon-status"&gt;Status Addon&lt;/a&gt; by Etch. This allows you to add custom status indicators to each component in the sidebar and above the story canvas area. The predefined statuses are &lt;code&gt;deprecated&lt;/code&gt;, &lt;code&gt;wip&lt;/code&gt;, &lt;code&gt;readyForQA&lt;/code&gt; and &lt;code&gt;stable&lt;/code&gt;. These can be edited/removed in &lt;code&gt;config/blast.php&lt;/code&gt;. You can read more about customizing the statues in the &lt;a href="https://github.com/area17/blast#readme"&gt;Blast docs&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Let's flag that our button component has passed QA and is ready for use by setting the status to &lt;code&gt;stable&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="nf"&gt;storybook&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
    &lt;span class="s1"&gt;'status'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'stable'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="mf"&gt;...&lt;/span&gt;
&lt;span class="p"&gt;])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Storybook will now be showing a green status indicator in the sidebar and a green tag above the canvas area.&lt;/p&gt;

&lt;h3&gt;
  
  
  Adding a Figma Design
&lt;/h3&gt;

&lt;p&gt;Blast also installs the &lt;a href="https://storybook.js.org/addons/storybook-addon-designs"&gt;design addon&lt;/a&gt; to allow you to embed Figma designs into your stories.&lt;/p&gt;

&lt;p&gt;To embed a design, copy the URL from Figma or use the URL below and update your &lt;code&gt;@storybook&lt;/code&gt; directive with the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="nf"&gt;storybook&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
    &lt;span class="s1"&gt;'design'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'https://www.figma.com/file/z3UTaD2Lt7d92J3n7fHKWI/Blast-Guide-Components?node-id=1%3A2'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="mf"&gt;...&lt;/span&gt;
&lt;span class="p"&gt;])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Blast will regenerate the story and reload Storybook. The 'Design' tab beneath your component should now be showing the button design directly within Storybook.&lt;/p&gt;

&lt;h3&gt;
  
  
  Using Presets
&lt;/h3&gt;

&lt;p&gt;Sometimes it may be helpful for components to share data. You may have a number of different button components which all have the same props so instead of repeating all of the &lt;code&gt;args&lt;/code&gt; and &lt;code&gt;argsTypes&lt;/code&gt; data across all of those, and having to update all of them individually when, for example, you add an icon, we can manage this in a what Blast calls a 'preset'.&lt;/p&gt;

&lt;p&gt;Blast allows you to create data presets to use in your stories. You can preset any of the options available in the &lt;code&gt;@storybook&lt;/code&gt; directive and they will be merged with any &lt;code&gt;args&lt;/code&gt; set directly in your story blade file. Presets allow you to write detailed stories faster and with more consistency.&lt;/p&gt;

&lt;p&gt;You may have noticed a &lt;code&gt;data&lt;/code&gt; directory was created when you initially launched Blast. Let's create a &lt;code&gt;button.php&lt;/code&gt; file in the &lt;code&gt;data&lt;/code&gt; directory which contains:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt;

&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="s1"&gt;'base'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="s1"&gt;'status'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'wip'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s1"&gt;'args'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
            &lt;span class="s1"&gt;'label'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'Button'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s1"&gt;'href'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'#'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s1"&gt;'icon'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'menu-24'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s1"&gt;'iconPosition'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'after'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;],&lt;/span&gt;
        &lt;span class="s1"&gt;'argTypes'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
            &lt;span class="s1"&gt;'iconPosition'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;
                &lt;span class="s1"&gt;'options'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
                    &lt;span class="s1"&gt;'before'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'after'&lt;/span&gt;
                &lt;span class="p"&gt;],&lt;/span&gt;
                &lt;span class="s1"&gt;'control'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
                    &lt;span class="s1"&gt;'type'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'radio'&lt;/span&gt;
                &lt;span class="p"&gt;]&lt;/span&gt;
            &lt;span class="p"&gt;],&lt;/span&gt;
            &lt;span class="s1"&gt;'icon'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;
                &lt;span class="s1"&gt;'options'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
                    &lt;span class="s1"&gt;'help-24'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'menu-24'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'plus-24'&lt;/span&gt;
                &lt;span class="p"&gt;],&lt;/span&gt;
                &lt;span class="s1"&gt;'control'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
                    &lt;span class="s1"&gt;'type'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'select'&lt;/span&gt;

                &lt;span class="p"&gt;]&lt;/span&gt;
            &lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This creates a preset of all of our button story config for us to use in our story blade files. All of the data in this preset can be overridden within your story. You could now go onto create 'secondary' and 'tertiary' button style without having to write any &lt;code&gt;args&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;To use the preset in your story update the &lt;code&gt;@storybook&lt;/code&gt; directive to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="nf"&gt;storybook&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
    &lt;span class="s1"&gt;'preset'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'button.base'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'name'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'Button with Icon'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'status'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'stable'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'design'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'https://www.figma.com/file/z3UTaD2Lt7d92J3n7fHKWI/Blast-Guide-Components?node-id=1%3A2'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Presets are referenced using dot notation starting with the filename followed by the indexes in the array within that file.&lt;/p&gt;

&lt;p&gt;Our story should look the same as before, however, the code is a lot simpler. Note that the &lt;code&gt;status&lt;/code&gt; is still showing 'stable' as it has overriden the &lt;code&gt;status&lt;/code&gt; in the preset.&lt;/p&gt;

&lt;h3&gt;
  
  
  Using &lt;code&gt;presetArgs&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Blast also allows you to reuse the &lt;code&gt;args&lt;/code&gt; from the presets when rendering components inside other components. For example, we have a button box component which contains a title and two of our primary button components.&lt;/p&gt;

&lt;p&gt;Create a story blade file for the button box component in &lt;code&gt;resources/views/stories/button-box/primary.blade.php&lt;/code&gt; containing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="nf"&gt;storybook&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
    &lt;span class="s1"&gt;'args'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="s1"&gt;'buttons'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
            &lt;span class="p"&gt;[&lt;/span&gt;
                &lt;span class="s1"&gt;'label'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'Button'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="s1"&gt;'href'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'#'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="s1"&gt;'icon'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'menu-24'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="s1"&gt;'iconPosition'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'after'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="p"&gt;],&lt;/span&gt;
            &lt;span class="p"&gt;[&lt;/span&gt;
                &lt;span class="s1"&gt;'label'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'Button'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="s1"&gt;'href'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'#'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="s1"&gt;'icon'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'menu-24'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="s1"&gt;'iconPosition'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'after'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;])&lt;/span&gt;

&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;button&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;box&lt;/span&gt;&lt;span class="mf"&gt;.&lt;/span&gt;&lt;span class="n"&gt;primary&lt;/span&gt;
    &lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$title&lt;/span&gt;&lt;span class="s2"&gt; ?? null"&lt;/span&gt;
    &lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="n"&gt;buttons&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$buttons&lt;/span&gt;&lt;span class="s2"&gt; ?? null"&lt;/span&gt;
&lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This works fine, however if we have a lot of duplicated code and should we ever change a prop on the button component, we would also need to update it here.&lt;/p&gt;

&lt;p&gt;We can get around this by using &lt;code&gt;presetArgs&lt;/code&gt;. &lt;code&gt;presetArgs&lt;/code&gt; tells Blast to go to a &lt;code&gt;preset&lt;/code&gt; and collect all of the &lt;code&gt;args&lt;/code&gt; and associate them with the set key within the component's data. As of Blast 1.1.1, &lt;code&gt;presetArgs&lt;/code&gt; can only be used within a &lt;code&gt;preset&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Create a preset for the button box component in &lt;code&gt;resources/views/stories/data/button-box.php&lt;/code&gt; containing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt;

&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="s1"&gt;'primary'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="s1"&gt;'presetArgs'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
            &lt;span class="s1"&gt;'buttons'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'button.base'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'button.base'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can go into your &lt;code&gt;button-box/primary.blade.php&lt;/code&gt; story file and remove the &lt;code&gt;buttons&lt;/code&gt; args and set the &lt;code&gt;preset&lt;/code&gt; to &lt;code&gt;button-box.primary&lt;/code&gt;. This will create the &lt;code&gt;buttons&lt;/code&gt; &lt;code&gt;args&lt;/code&gt; data using the preset args we created earlier.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="nf"&gt;storybook&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
    &lt;span class="s1"&gt;'preset'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'button-box.primary'&lt;/span&gt;
&lt;span class="p"&gt;])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These &lt;code&gt;presetArgs&lt;/code&gt; can still be merged with other &lt;code&gt;args&lt;/code&gt; data in the same way you would with a regular preset. Let's set a title for our button box outside of the preset:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="nf"&gt;storybook&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
    &lt;span class="s1"&gt;'preset'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'button-box.primary'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'args'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="s1"&gt;'title'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'Button Box'&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;])&lt;/span&gt;

&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;button&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;box&lt;/span&gt;&lt;span class="mf"&gt;.&lt;/span&gt;&lt;span class="n"&gt;primary&lt;/span&gt;
    &lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$title&lt;/span&gt;&lt;span class="s2"&gt; ?? null"&lt;/span&gt;
    &lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="n"&gt;buttons&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$buttons&lt;/span&gt;&lt;span class="s2"&gt; ?? null"&lt;/span&gt;
&lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Documentation
&lt;/h3&gt;

&lt;p&gt;Storybook automatically generates a 'Docs' tab alongside the canvas view of your component which details the component's props but Blast allows you to add to this by creating a &lt;code&gt;README.md&lt;/code&gt; file alongside your component's story blade file.&lt;/p&gt;

&lt;p&gt;Create a &lt;code&gt;README.md&lt;/code&gt; in your &lt;code&gt;stories/button&lt;/code&gt; directory and write some documentation for your new button component. When you save the file, Blast will regenerate the story and update Storybook. The &lt;code&gt;README&lt;/code&gt; contents will now be visible in the 'Docs' tab of your story.&lt;/p&gt;

&lt;h2&gt;
  
  
  Using the &lt;code&gt;DocsPage&lt;/code&gt; Component
&lt;/h2&gt;

&lt;p&gt;At AREA 17 we use a generic 'page' component to document more global parts of the design system like colors, grid system, typography, etc. Blast ships with a basic &lt;code&gt;DocsPage&lt;/code&gt; component to allow you to do the same.&lt;/p&gt;

&lt;p&gt;We'll use one to create an introduction page for the components in our guide.&lt;/p&gt;

&lt;p&gt;Create &lt;code&gt;introduction.blade.php&lt;/code&gt; in the root of your &lt;code&gt;stories&lt;/code&gt; directory and add the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="nf"&gt;storybook&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
    &lt;span class="s1"&gt;'layout'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'fullscreen'&lt;/span&gt;
&lt;span class="p"&gt;])&lt;/span&gt;

&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;docs&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;page&lt;/span&gt;
    &lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Blast 🚀"&lt;/span&gt;
    &lt;span class="n"&gt;label&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"About"&lt;/span&gt;
    &lt;span class="n"&gt;description&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Storybook for Laravel Blade"&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;

&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="o"&gt;!!&lt;/span&gt; &lt;span class="nc"&gt;Str&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;markdown&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"# Introduction

This is the `DocsPage` component. You can put whatever you like into the main slot and it will render in the center column of the page. It also has 3 props - `title`, `label` and `description` - to fill out the content in the component header.

Be sure to set `layout` to `fullscreen` so it all renders correctly in the Storybook UI.
"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!!&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;docs&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;page&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will create a new story containing a fullscreen 'page' layout. You can use the &lt;code&gt;title&lt;/code&gt;, &lt;code&gt;label&lt;/code&gt; and &lt;code&gt;description&lt;/code&gt; props to update the header content, and the component's main slot to update the body content.&lt;/p&gt;

&lt;h2&gt;
  
  
  Generating a Static Storybook app with Blast
&lt;/h2&gt;

&lt;p&gt;Everything we've just created is working great in dev but now we want to build a static version of our Storybook app to deploy on our server. We can do this by running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan blast:publish
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This task runs &lt;a href="https://storybook.js.org/docs/react/workflows/publish-storybook"&gt;Storybook's &lt;code&gt;build-storybook&lt;/code&gt; command&lt;/a&gt; and publishes the generated storybook app to your public folder to allow it to be deployed alongside your application.&lt;/p&gt;

&lt;h2&gt;
  
  
  Automated Accessibility Testing
&lt;/h2&gt;

&lt;p&gt;Blast uses the &lt;a href="https://storybook.js.org/addons/@storybook/addon-a11y"&gt;Storybook Accessibility addon&lt;/a&gt; to automatically test your components from within Storybook using &lt;a href="https://www.deque.com/axe/"&gt;Axe&lt;/a&gt;. It lists passed, failing and incomplete tests and allows you to highlight the elements in your components relating to each test as well as a full description of the test as well as reasons why it failed and the standard the test falls under.&lt;/p&gt;

&lt;h2&gt;
  
  
  Customization
&lt;/h2&gt;

&lt;p&gt;Storybook's UI looks great out of the box but sometimes we want to add our own branding to it. Blast allows you to complete control over the Storybook UI via the &lt;code&gt;storybook_theme&lt;/code&gt; option in &lt;code&gt;config/blast.php&lt;/code&gt;. You can read more about the theming options in the &lt;a href="https://storybook.js.org/docs/react/configure/theming"&gt;official Storybook documentation&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;There we have it. We have created our first component stories in Blast, customized our Storybook UI and published a static Storybook application to our Laravel app.&lt;/p&gt;

&lt;p&gt;We are constantly working on improvements and new features for Blast and please swing by &lt;a href="https://github.com/area17/blast"&gt;our Github&lt;/a&gt; with any ideas or PRs!&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>laravel</category>
      <category>storybook</category>
      <category>blade</category>
    </item>
  </channel>
</rss>
