---
title: "story_designer"
---

[< Back to Reference](../reference.qmd) | [View source](https://codeberg.org/usrbinr/stwd/src/branch/main/R/story_designer.R#L40)

# `story_designer()`

Interactive Story Layout Designer

## Usage

```r
story_designer(
  plot = NULL,
  title = "**Your {#E69F00 title} here**",
  subtitle = "Supporting context for your visualization",
  narrative = "**KEY INSIGHT:**\nYour narrative here.",
  caption = "SOURCE: Your data source"
)
```

## Arguments

| Argument | Description |
|----------|-------------|
| `plot` | Optional ggplot object to include in the preview. If NULL, a placeholder chart is used. |
| `title` | Initial title text. Supports marquee formatting. |
| `subtitle` | Initial subtitle text. |
| `narrative` | Initial narrative text for the side panel. |
| `caption` | Initial caption/source text. |

## Value

Launches a Shiny app. Returns NULL invisibly.

## Description

Launches a Shiny app to interactively design story layouts with
real-time preview. Provides controls for text blocks, color palettes,
themes, and exports ready-to-use patchwork code.

## Details

The Story Designer is the primary interface for creating SWD-style
visualizations. It provides a WYSIWYG editor with live preview,
allowing you to adjust text, colors, and layout before copying the
generated patchwork code into your Quarto document or R script.

The workflow is: (1) create your base ggplot, (2) pass it to
`story_designer()`, (3) customize using the sidebar controls,
(4) copy the code from the Code tab, (5) paste into your document.

Text inputs support marquee formatting syntax: **bold** for bold,
*italic* for italics, and {#HEXCOLOR text for colored text.

## Examples

```r
## Not run: 
library(ggplot2)
p <- ggplot(mtcars, aes(factor(cyl), mpg, fill = factor(cyl))) +
  geom_col()
story_designer(plot = p, title = "**Fuel Economy** by {#E69F00 Cylinders}")

## End(Not run)
```

