Skip to content

Draft notice

The line at the top of a page that only its author can see yet, in a dashed box.

<article aria-labelledby="sample-page-title">
  <p class="cap-draft-notice" id="sample-default"><span class="cap-draft-notice-tag">Draft<span class="cap-sr-only">:</span></span><span>Only you can see this page.</span></p>
  <h3 id="sample-page-title">Spring update</h3>
  <p>The first notes of the season, written up for Example Co.</p>
</article>

Installation

// package.json: "capsomer": "github:DrDustinEdwards/capsomer#v0.152.2"
import "capsomer/tokens.css";
import "capsomer/base.css";
import "capsomer/draft-notice.css";

Usage

<p class="cap-draft-notice">
  <span class="cap-draft-notice-tag">Draft<span class="cap-sr-only">:</span></span>
  <span>Only you can see this page.</span>
</p>

Examples

Other words, from React

<div data-mount="words"></div>

Not a draft: nothing drawn

<div data-mount="hidden"></div>
<p>A published page shows no notice.</p>

API reference

DraftNotice

PropTypeRequiredDoes
showbooleanDraws nothing when false, so a page writes <DraftNotice show={draft} /> in place of a conditional.
labelstringThe word in the box.
childrenReactNodeThe sentence after it: who can see the page.

Parts and data attributes

ClassIs
.cap-draft-noticethe root
.cap-draft-notice-taga part

Accessibility

KeyDoes
NoneThe notice is text
  • Read as one sentence, "Draft: Only you can see this page.": the colon after the word is visually hidden.
  • The word and the sentence are --text; the dashed edge is --warn at 3:1, and CanvasText in forced colors.