Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(dashboards): add word art blocks to text cards (#69359)

Jon McCallumd0c664dd5691
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index d573730369c2..cb803eb75842 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -316,6 +316,10 @@ snapshots:
hash: v1.k794b7964.ad69dd2d12211ec94d2ba3a988482c8a5a3db0536c20394300d8df9138ad9186.rHFMsMBsfpwjJ_mlwWmDFzJESrnSEdcBVt4OOQpiDfw
components-cards-text-card--with-more-button-placed-in-public--light:
hash: v1.k794b7964.5f6f2d7a547d538eb6f5f33f6a3d2c169d963e73814a88cbb9926b1057bbd0df.h0qr4w97vqcaO5nfHJTv6H6XdpsH95Ln6_s4eHCSsDM
+ components-cards-text-card--word-art--dark:
+ hash: v1.k794b7964.0102b5932e02a20b3e9ebe64e598044973f2ea5e8311fbc60f2bc4d4ac71dd34.WWzoCG5jIHDxccStvfV99L1mEDBwUR-s5gv1Ra53etE
+ components-cards-text-card--word-art--light:
+ hash: v1.k794b7964.bbfbdf1c0cb4a9c5e2ebd29ea6d06eb292a761c70b1936ff7bea8a2e5294c9ef.cClgUmOs2MuzU2HfkFbT4TxQEVcQ3U2ipOGtvtqIHoo
components-compact-list--compact-list--dark:
hash: v1.k794b7964.59d9b22dc4c1fabb38cfa1c8072b3f6e3e4140bfddef6160e568f935c0ba7f29.aeZmv2PM9H27yaixZr0lFX-5hBEr1ET0-8F-DJP_QS4
components-compact-list--compact-list--light:
diff --git a/frontend/src/lib/components/Cards/TextCard/TextCard.stories.tsx b/frontend/src/lib/components/Cards/TextCard/TextCard.stories.tsx
index 3758901777b3..ffed3125c85f 100644
--- a/frontend/src/lib/components/Cards/TextCard/TextCard.stories.tsx
+++ b/frontend/src/lib/components/Cards/TextCard/TextCard.stories.tsx
@@ -3,6 +3,7 @@ import type { Meta, StoryObj } from '@storybook/react'
import { DashboardPlacement, DashboardTile, InsightColor, QueryBasedInsightModel } from '~/types'
import { TextCard } from './TextCard'
+import { WORD_ART_PRESETS } from './WordArt/wordArtPresets'
const meta: Meta = {
title: 'Components/Cards/Text Card',
@@ -85,6 +86,22 @@ export const Template: Story = {
},
}
+export const WordArt: Story = {
+ render: () => {
+ const body = WORD_ART_PRESETS.map((preset) => `<span data-word-art="${preset.id}">${preset.label}</span>`).join(
+ '\n\n'
+ )
+ return (
+ <div className="max-w-160">
+ <TextCard
+ textTile={makeTextTile(`# Every word art style\n\n${body}`)}
+ placement={DashboardPlacement.Dashboard}
+ />
+ </div>
+ )
+ },
+}
+
export const WithMoreButton: Story = {
render: () => {
return (
diff --git a/frontend/src/lib/components/Cards/TextCard/WordArt/WordArt.scss b/frontend/src/lib/components/Cards/TextCard/WordArt/WordArt.scss
new file mode 100644
index 000000000000..b88c590e5ac5
--- /dev/null
+++ b/frontend/src/lib/components/Cards/TextCard/WordArt/WordArt.scss
@@ -0,0 +1,144 @@
+// Effect colors are intentionally hardcoded so styles render identically in light/dark mode and exports
+.WordArt {
+ display: inline-block;
+
+ // Breathing room so glows/shadows aren't clipped by overflow-auto ancestors
+ padding: 0.35em 0.3em;
+ font-size: 2em;
+ font-style: normal;
+ font-weight: 900;
+ line-height: 1.1;
+ letter-spacing: 0.02em;
+ white-space: pre-wrap;
+
+ &.WordArt--rainbow {
+ color: transparent;
+ background: linear-gradient(90deg, #f00, #f80, #fc0, #0a0, #06f, #83f);
+ background-clip: text;
+ }
+
+ &.WordArt--sunset {
+ color: transparent;
+ background: linear-gradient(180deg, #ff5f6d 0%, #ff9a44 55%, #a44fd0 100%);
+ filter: drop-shadow(0 0.06em 0.08em rgb(164 79 208 / 40%));
+ background-clip: text;
+ }
+
+ &.WordArt--chrome {
+ color: transparent;
+ background: linear-gradient(
+ 180deg,
+ #eef3f8 0%,
+ #b8c6db 38%,
+ #5a749c 49%,
+ #2e4a76 51%,
+ #7fa3d4 62%,
+ #d9e6f5 100%
+ );
+ background-clip: text;
+ -webkit-text-stroke: 1px #47586e;
+ }
+
+ &.WordArt--neon {
+ color: #ff2ee6;
+ text-shadow:
+ 0 0 0.08em #fff,
+ 0 0 0.25em #ff2ee6,
+ 0 0 0.55em #b517ff;
+ }
+
+ &.WordArt--outline {
+ // White fill + stroke-under-fill: glyph paths self-intersect (e.g. the bar of "e"),
+ // so a transparent fill would expose internal stroke edges as lines through the letters
+ color: #fff;
+ paint-order: stroke;
+ -webkit-text-stroke: 4px #f54e00;
+ }
+
+ &.WordArt--extrude {
+ color: #2f80ed;
+ text-shadow:
+ 0.02em 0.02em 0 #1b4f9c,
+ 0.04em 0.04em 0 #1b4f9c,
+ 0.06em 0.06em 0 #1b4f9c,
+ 0.08em 0.08em 0 #1b4f9c,
+ 0.1em 0.1em 0 #1b4f9c,
+ 0.12em 0.12em 0 #1b4f9c,
+ 0.14em 0.14em 0.16em rgb(0 0 0 / 35%);
+ transform: skewY(-3deg);
+ }
+
+ &.WordArt--shadow {
+ font-style: italic;
+ color: #fff;
+ text-shadow: 0.1em 0.1em 0 #000;
+ -webkit-text-stroke: 1px #000;
+ }
+
+ &.WordArt--fire {
+ color: transparent;
+ background: linear-gradient(0deg, #c00 0%, #f60 45%, #fc0 75%, #ffa 100%);
+ filter: drop-shadow(0 -0.04em 0.12em rgb(255 120 0 / 55%));
+ background-clip: text;
+ }
+
+ &.WordArt--ice {
+ color: transparent;
+ background: linear-gradient(180deg, #fff 0%, #a5f3fc 55%, #0ea5e9 100%);
+ background-clip: text;
+ -webkit-text-stroke: 1px #0369a1;
+ }
+
+ &.WordArt--stripes {
+ color: transparent;
+ background: repeating-linear-gradient(180deg, #f36 0 0.14em, #fff 0.14em 0.2em, #36f 0.2em 0.34em);
+ background-clip: text;
+ -webkit-text-stroke: 1px #1a1a4d;
+ }
+}
+
+// 9em of width ≈ 1em of glyph height given the 500x170 viewBox, so the arch tracks font-size like the CSS styles
+.WordArt--arch-svg {
+ display: inline-block;
+ width: 9em;
+ max-width: 100%;
+ font-size: 2em;
+ vertical-align: middle;
+}
+
+.WordArt,
+.WordArt--arch-svg {
+ // Explicit so the class emitted for the default 'small' size maps to a real rule
+ &.WordArt--size-small {
+ font-size: 2em;
+ }
+
+ &.WordArt--size-medium {
+ font-size: 3em;
+ }
+
+ &.WordArt--size-large {
+ font-size: 4.5em;
+ }
+}
+
+.WordArtNode {
+ display: inline-block;
+ max-width: 100%;
+}
+
+.WordArtNode--editable {
+ cursor: pointer;
+}
+
+.WordArtNode--selected {
+ border-radius: 4px;
+ outline: 2px solid var(--color-accent);
+ outline-offset: 2px;
+}
+
+.WordArt.WordArt--preview,
+.WordArt--arch-svg.WordArt--preview {
+ font-size: 1.375rem;
+ white-space: nowrap;
+}
diff --git a/frontend/src/lib/components/Cards/TextCard/WordArt/WordArtExtension.tsx b/frontend/src/lib/components/Cards/TextCard/WordArt/WordArtExtension.tsx
new file mode 100644
index 000000000000..85cf296e7b36
--- /dev/null
+++ b/frontend/src/lib/components/Cards/TextCard/WordArt/WordArtExtension.tsx
@@ -0,0 +1,130 @@
+import { Node, mergeAttributes } from '@tiptap/core'
+import { NodeViewProps, NodeViewWrapper, ReactNodeViewRenderer } from '@tiptap/react'
+import clsx from 'clsx'
+import { useState } from 'react'
+
+import { WordArtModal } from './WordArtModal'
+import {
+ DEFAULT_WORD_ART_SIZE,
+ DEFAULT_WORD_ART_STYLE,
+ normalizeWordArtSize,
+ normalizeWordArtStyle,
+} from './wordArtPresets'
+import { WordArtText } from './WordArtText'
+
+function escapeHtmlText(value: string): string {
+ return value.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;')
+}
+
+function WordArtNodeView(props: NodeViewProps): JSX.Element {
+ const [isModalOpen, setIsModalOpen] = useState(false)
+ const { text, style, size } = props.node.attrs
+ const isEditable = props.editor.isEditable
+
+ return (
+ <NodeViewWrapper
+ as="span"
+ className={clsx(
+ 'WordArtNode',
+ isEditable && 'WordArtNode--editable',
+ props.selected && 'WordArtNode--selected'
+ )}
+ // No handler while open: the modal is a portal inside this wrapper, so its clicks bubble back here
+ onClick={isEditable && !isModalOpen ? () => setIsModalOpen(true) : undefined}
+ data-attr="word-art-node"
+ >
+ <WordArtText text={text} style={style} size={size} />
+ {isModalOpen && (
+ <WordArtModal
+ onClose={() => setIsModalOpen(false)}
+ initialText={text}
+ initialStyle={style}
+ initialSize={size}
+ onSave={(attrs) => {
+ props.updateAttributes(attrs)
+ setIsModalOpen(false)
+ }}
+ />
+ )}
+ </NodeViewWrapper>
+ )
+}
+
+export const WordArtExtension = Node.create({
+ name: 'wordArt',
+
+ group: 'inline',
+ inline: true,
+ atom: true,
+ selectable: true,
+
+ addAttributes() {
+ return {
+ text: {
+ default: '',
+ parseHTML: (element) => element.textContent ?? '',
+ renderHTML: () => ({}),
+ },
+ style: {
+ default: DEFAULT_WORD_ART_STYLE,
+ parseHTML: (element) => normalizeWordArtStyle(element.getAttribute('data-word-art')),
+ renderHTML: (attributes) => ({ 'data-word-art': attributes.style }),
+ },
+ size: {
+ default: DEFAULT_WORD_ART_SIZE,
+ parseHTML: (element) => normalizeWordArtSize(element.getAttribute('data-word-art-size')),
+ renderHTML: (attributes) =>
+ attributes.size === DEFAULT_WORD_ART_SIZE ? {} : { 'data-word-art-size': attributes.size },
+ },
+ }
+ },
+
+ parseHTML() {
+ return [{ tag: 'span[data-word-art]' }]
+ },
+
+ renderHTML({ node, HTMLAttributes }) {
+ return ['span', mergeAttributes(HTMLAttributes), String(node.attrs.text ?? '')]
+ },
+
+ renderMarkdown(node) {
+ const style = normalizeWordArtStyle(node.attrs?.style as string)
+ const size = normalizeWordArtSize(node.attrs?.size as string)
+ const text = String(node.attrs?.text ?? '')
+ const sizeAttribute = size === DEFAULT_WORD_ART_SIZE ? '' : ` data-word-art-size="${size}"`
+ return `<span data-word-art="${style}"${sizeAttribute}>${escapeHtmlText(text)}</span>`
+ },
+
+ addNodeView() {
+ return ReactNodeViewRenderer(WordArtNodeView)
+ },
+
+ addCommands() {
+ return {
+ insertWordArt:
+ (options: { text: string; style: string; size?: string }) =>
+ ({ commands }) => {
+ const text = options.text.trim()
+ if (!text) {
+ return false
+ }
+ return commands.insertContent({
+ type: this.name,
+ attrs: {
+ text,
+ style: normalizeWordArtStyle(options.style),
+ size: normalizeWordArtSize(options.size),
+ },
+ })
+ },
+ }
+ },
+})
+
+declare module '@tiptap/core' {
+ interface Commands<ReturnType> {
+ wordArt: {
+ insertWordArt: (options: { text: string; style: string; size?: string }) => ReturnType
+ }
+ }
+}
diff --git a/frontend/src/lib/components/Cards/TextCard/WordArt/WordArtModal.tsx b/frontend/src/lib/components/Cards/TextCard/WordArt/WordArtModal.tsx
new file mode 100644
index 000000000000..7c41ba9b1913
--- /dev/null
+++ b/frontend/src/lib/components/Cards/TextCard/WordArt/WordArtModal.tsx
@@ -0,0 +1,109 @@
+import clsx from 'clsx'
+import { useState } from 'react'
+
+import { LemonButton, LemonInput, LemonModal, LemonSegmentedButton } from '@posthog/lemon-ui'
+
+import { capitalizeFirstLetter } from 'lib/utils/strings'
+
+import {
+ normalizeWordArtSize,
+ normalizeWordArtStyle,
+ WordArtSize,
+ WORD_ART_PRESETS,
+ WORD_ART_SIZES,
+} from './wordArtPresets'
+import { WordArtText } from './WordArtText'
+
+const SIZE_OPTIONS = WORD_ART_SIZES.map((value) => ({
+ value,
+ label: value[0].toUpperCase(),
+ tooltip: capitalizeFirstLetter(value),
+ 'data-attr': `word-art-size-${value}`,
+}))
+
+export function WordArtModal({
+ onClose,
+ onSave,
+ initialText,
+ initialStyle,
+ initialSize,
+}: {
+ onClose: () => void
+ onSave: (attrs: { text: string; style: string; size: WordArtSize }) => void
+ initialText?: string
+ initialStyle?: string
+ initialSize?: string
+}): JSX.Element {
+ const [text, setText] = useState(initialText ?? '')
+ const [style, setStyle] = useState(normalizeWordArtStyle(initialStyle))
+ const [size, setSize] = useState<WordArtSize>(normalizeWordArtSize(initialSize))
+
+ const trimmedText = text.trim()
+ const previewText = trimmedText || 'Your text here'
+
+ const save = (): void => {
+ if (trimmedText) {
+ onSave({ text: trimmedText, style, size })
+ }
+ }
+
+ return (
+ <LemonModal
+ isOpen
+ onClose={onClose}
+ title="Word art"
+ description="Pick a style. Yes, all of them are tasteful."
+ width={640}
+ forceAbovePopovers
+ footer={
+ <>
+ <LemonButton type="secondary" onClick={onClose}>
+ Cancel
+ </LemonButton>
+ <LemonButton
+ type="primary"
+ onClick={save}
+ disabledReason={!trimmedText ? 'Enter some text first' : undefined}
+ >
+ {initialText ? 'Update' : 'Insert'}
+ </LemonButton>
+ </>
+ }
+ >
+ <div className="flex flex-col gap-4">
+ <div className="flex items-center gap-2">
+ <LemonInput
+ value={text}
+ onChange={setText}
+ placeholder="Your text here"
+ maxLength={100}
+ autoFocus
+ onPressEnter={save}
+ data-attr="word-art-text-input"
+ className="flex-1"
+ />
+ <LemonSegmentedButton value={size} onChange={setSize} options={SIZE_OPTIONS} size="small" />
+ </div>
+ <div className="grid grid-cols-3 gap-2">
+ {WORD_ART_PRESETS.map((preset) => (
+ <button
+ key={preset.id}
+ type="button"
+ title={preset.label}
+ data-attr={`word-art-style-${preset.id}`}
+ onClick={() => setStyle(preset.id)}
+ className={clsx(
+ 'flex h-24 items-center justify-center overflow-hidden rounded border bg-white p-2',
+ style === preset.id
+ ? 'border-accent ring-1 ring-accent'
+ : 'border-primary hover:border-accent'
+ )}
+ >
+ <WordArtText text={previewText} style={preset.id} className="WordArt--preview" />
+ </button>
+ ))}
+ </div>
+ </div>
+ </LemonModal>
+ )
+}
diff --git a/frontend/src/lib/components/Cards/TextCard/WordArt/WordArtText.tsx b/frontend/src/lib/components/Cards/TextCard/WordArt/WordArtText.tsx
new file mode 100644
index 000000000000..040176258fdc
--- /dev/null
+++ b/frontend/src/lib/components/Cards/TextCard/WordArt/WordArtText.tsx
@@ -0,0 +1,56 @@
+import './WordArt.scss'
+
+import clsx from 'clsx'
+import { useId } from 'react'
+
+import { DEFAULT_WORD_ART_SIZE } from './wordArtPresets'
+
+const ARCH_PATH_LENGTH = 465
+
+function WordArtArched({ text, className }: { text: string; className?: string }): JSX.Element {
+ const gradientId = useId()
+
+ return (
+ <svg viewBox="0 0 500 170" className={clsx('WordArt--arch-svg', className)} role="img" aria-label={text}>
+ <defs>
+ <linearGradient id={gradientId} x1="0" y1="0" x2="1" y2="0">
+ <stop offset="0%" stopColor="#7b2ff7" />
+ <stop offset="50%" stopColor="#f107a3" />
+ <stop offset="100%" stopColor="#ff8c37" />
+ </linearGradient>
+ </defs>
+ <path id={`${gradientId}-path`} d="M 30 150 Q 250 30 470 150" fill="none" />
+ <text fontSize={56} fontWeight={900} fill={`url(#${gradientId})`} stroke="#4a1772" strokeWidth={1}>
+ <textPath
+ href={`#${gradientId}-path`}
+ startOffset="50%"
+ textAnchor="middle"
+ textLength={ARCH_PATH_LENGTH}
+ lengthAdjust="spacingAndGlyphs"
+ >
+ {text}
+ </textPath>
+ </text>
+ </svg>
+ )
+}
+
+export function WordArtText({
+ text,
+ style,
+ size = DEFAULT_WORD_ART_SIZE,
+ className,
+}: {
+ text: string
+ style: string
+ size?: string
+ className?: string
+}): JSX.Element {
+ const sizeClass = `WordArt--size-${size}`
+
+ if (style === 'arch') {
+ return <WordArtArched text={text} className={clsx(sizeClass, className)} />
+ }
+
+ return <span className={clsx('WordArt', `WordArt--${style}`, sizeClass, className)}>{text}</span>
+}
diff --git a/frontend/src/lib/components/Cards/TextCard/WordArt/wordArtPresets.ts b/frontend/src/lib/components/Cards/TextCard/WordArt/wordArtPresets.ts
new file mode 100644
index 000000000000..eb6ddca460d3
--- /dev/null
+++ b/frontend/src/lib/components/Cards/TextCard/WordArt/wordArtPresets.ts
@@ -0,0 +1,34 @@
+interface WordArtPreset {
+ id: string
+ label: string
+}
+
+export const WORD_ART_PRESETS: WordArtPreset[] = [
+ { id: 'rainbow', label: 'Rainbow' },
+ { id: 'sunset', label: 'Sunset' },
+ { id: 'chrome', label: 'Chrome' },
+ { id: 'neon', label: 'Neon sign' },
+ { id: 'outline', label: 'Outline' },
+ { id: 'extrude', label: '3D blocks' },
+ { id: 'shadow', label: 'Hard shadow' },
+ { id: 'fire', label: 'Fire' },
+ { id: 'ice', label: 'Ice' },
+ { id: 'stripes', label: 'Retro stripes' },
+ { id: 'arch', label: 'Arch' },
+]
+
+export const DEFAULT_WORD_ART_STYLE = 'rainbow'
+
+export function normalizeWordArtStyle(value: string | null | undefined): string {
+ return WORD_ART_PRESETS.some((preset) => preset.id === value) ? (value as string) : DEFAULT_WORD_ART_STYLE
+}
+
+export type WordArtSize = 'small' | 'medium' | 'large'
+
+export const WORD_ART_SIZES: WordArtSize[] = ['small', 'medium', 'large']
+
+export const DEFAULT_WORD_ART_SIZE: WordArtSize = 'medium'
+
+export function normalizeWordArtSize(value: string | null | undefined): WordArtSize {
+ return WORD_ART_SIZES.includes(value as WordArtSize) ? (value as WordArtSize) : DEFAULT_WORD_ART_SIZE
+}
diff --git a/frontend/src/lib/components/Cards/TextCard/textCardMarkdown.test.ts b/frontend/src/lib/components/Cards/TextCard/textCardMarkdown.test.ts
index 0a05e37d872d..9aead59359b1 100644
--- a/frontend/src/lib/components/Cards/TextCard/textCardMarkdown.test.ts
+++ b/frontend/src/lib/components/Cards/TextCard/textCardMarkdown.test.ts
@@ -132,6 +132,41 @@ describe('textCardMarkdown', () => {
expect(serialized).toContain('++underlined++')
})
+ it.each([
+ ['plain text', 'BIG WINS', 'chrome', 'chrome', 'medium', 'medium'],
+ ['text with html-sensitive characters', 'Q3 <wins> & *losses*', 'neon', 'neon', 'medium', 'medium'],
+ ['unknown style id normalized to default', 'hello', 'clippy-3000', 'rainbow', 'medium', 'medium'],
+ ['a non-default size', 'HUGE', 'fire', 'fire', 'large', 'large'],
+ ['unknown size normalized to default', 'hello', 'ice', 'ice', 'gigantic', 'medium'],
+ ])('round-trips word art with %s', (_name, text, style, expectedStyle, size, expectedSize) => {
+ const doc: JSONContent = {
+ type: 'doc',
+ content: [
+ {
+ type: 'paragraph',
+ content: [
+ { type: 'text', text: 'before ' },
+ { type: 'wordArt', attrs: { text, style, size } },
+ { type: 'text', text: ' after' },
+ ],
+ },
+ ],
+ }
+
+ const markdown = textCardDocToMarkdown(doc)
+ const roundTripDoc = markdownToTextCardDoc(markdown)
+ const wordArtNode = roundTripDoc.content?.[0]?.content?.find((node) => node.type === 'wordArt')
+
+ expect(markdown).toContain(`<span data-word-art="${expectedStyle}"`)
+ if (expectedSize === 'medium') {
+ expect(markdown).not.toContain('data-word-art-size')
+ } else {
+ expect(markdown).toContain(`data-word-art-size="${expectedSize}"`)
+ }
+ expect(wordArtNode?.attrs).toEqual({ text, style: expectedStyle, size: expectedSize })
+ expect(isTextCardMarkdownRoundTripSafe(markdown)).toBe(true)
+ })
+
it('uses non-clickable links while editing and clickable links in readonly', () => {
const editableLink = TEXT_CARD_MARKDOWN_EXTENSIONS.find((extension) => extension.name === 'link')
const readonlyLink = TEXT_CARD_MARKDOWN_READONLY_EXTENSIONS.find((extension) => extension.name === 'link')
diff --git a/frontend/src/lib/components/Cards/TextCard/textCardMarkdown.ts b/frontend/src/lib/components/Cards/TextCard/textCardMarkdown.ts
index db173703af96..bde05050d3d6 100644
--- a/frontend/src/lib/components/Cards/TextCard/textCardMarkdown.ts
+++ b/frontend/src/lib/components/Cards/TextCard/textCardMarkdown.ts
@@ -7,6 +7,8 @@ import StarterKit from '@tiptap/starter-kit'
import { expandFlattenedMarkdownTables } from 'lib/utils/markdown'
+import { WordArtExtension } from './WordArt/WordArtExtension'
+
function escapeHtmlAttribute(value: string): string {
return value.replace(/&/g, '&amp;').replace(/"/g, '&quot;')
}
@@ -45,6 +47,7 @@ const TEXT_CARD_MARKDOWN_BASE_EXTENSIONS = [
}),
TaskList,
TaskItem.configure({ nested: true }),
+ WordArtExtension,
]
const TEXT_CARD_MARKDOWN_BASE_EDITABLE_EXTENSIONS = [
diff --git a/frontend/src/lib/components/MarkdownEditor/shared/RichMarkdownEditorFormatControls.tsx b/frontend/src/lib/components/MarkdownEditor/shared/RichMarkdownEditorFormatControls.tsx
index 944c11e17b38..24cf576d85c5 100644
--- a/frontend/src/lib/components/MarkdownEditor/shared/RichMarkdownEditorFormatControls.tsx
+++ b/frontend/src/lib/components/MarkdownEditor/shared/RichMarkdownEditorFormatControls.tsx
@@ -1,8 +1,11 @@
import { Editor } from '@tiptap/core'
+import { useState } from 'react'
-import { IconCode, IconList, IconMinus } from '@posthog/icons'
+import { IconCode, IconList, IconMinus, IconPalette } from '@posthog/icons'
import { LemonButton, LemonDivider, LemonInput, LemonMenu } from '@posthog/lemon-ui'
+import { WordArtModal } from 'lib/components/Cards/TextCard/WordArt/WordArtModal'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { IconBold, IconItalic, IconLink, IconTextSize } from 'lib/lemon-ui/icons'
import { Popover } from 'lib/lemon-ui/Popover'
@@ -55,6 +58,8 @@ export function RichMarkdownEditorFormatControls({
clearLinkPopoverReference,
}: RichMarkdownEditorFormatControlsProps): JSX.Element {
const hasExistingLink = editor?.isActive('link') ?? false
+ const [showWordArtModal, setShowWordArtModal] = useState(false)
+ const wordArtAvailable = useFeatureFlag('TEXT_CARD_WORD_ART') && !!editor?.schema.nodes.wordArt
const setLink = (): void => {
if (!linkUrl || !editor) {
@@ -202,6 +207,26 @@ export function RichMarkdownEditorFormatControls({
tooltip="Lists"
/>
</LemonMenu>
+ {wordArtAvailable && (
+ <>
+ <LemonButton
+ size="small"
+ icon={<IconPalette />}
+ onClick={() => setShowWordArtModal(true)}
+ tooltip="Word art"
+ data-attr="word-art-toolbar-button"
+ />
+ {showWordArtModal && (
+ <WordArtModal
+ onClose={() => setShowWordArtModal(false)}
+ onSave={(attrs) => {
+ editor?.chain().focus().insertWordArt(attrs).run()
+ setShowWordArtModal(false)
+ }}
+ />
+ )}
+ </>
+ )}
<Popover
key={
linkPopoverReferenceElement ? 'markdown-link-popover-external-ref' : 'markdown-link-popover-toolbar'
diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsx
index e099fbad95ca..b79ca8b7c3d7 100644
--- a/frontend/src/lib/constants.tsx
+++ b/frontend/src/lib/constants.tsx
@@ -498,6 +498,7 @@ export const FEATURE_FLAGS = {
TAXONOMIC_FILTER_CATEGORY_DROPDOWN: 'taxonomic-filter-category-dropdown', // owner: @pauldambra #team-product-analytics multivariate=control,pill
TAXONOMIC_FILTER_DEFAULT_PINS: 'taxonomic-filter-default-pins', // owner: @pauldambra #team-product-analytics, seeds $current_url/email default pinned filters
TAXONOMIC_FILTER_MENU_REBUILD: 'taxonomic-filter-menu-rebuild', // owner: @adamleith, opt-in to the rebuilt TaxonomicFilter — headless filter panel + new popover menu (column / preview-pane)
+ TEXT_CARD_WORD_ART: 'text-card-word-art', // owner: @jonmcwest, gates the word art insert button in dashboard text cards
TOOLBAR_HEATMAP_AREA_FILTER: 'toolbar-heatmap-area-filter', // owner: @pauldambra #team-replay, gates the target button that filters the toolbar heatmap/clickmap to a chosen page area
TRACING: 'tracing', // owner: #team-apm (@jonmcwest, @frankh)
TRACING_FACET_RAIL: 'tracing-facet-rail', // owner: #team-apm — gates the facet rail (faceted filter sidebar) in tracing