Skip to content

Fireflies

The night field: fireflies that drift and twinkle behind a section, and never sit on its words.

import { Fireflies } from '@sypnia/ui/react'

On this page
  1. Behind a hero
  2. In Astro, on paper
  3. When to use it
  4. For everyone
  5. Props

Behind a hero

Scattered from a seed, so the server and the browser draw the same field. The ones that would touch text, buttons or panels are dropped, and again when the window changes size.

Every bug leaves a light on.

Sypnia follows it back to where it started.

Code
import { Button, Fireflies } from '@sypnia/ui/react';

// The section is relative and isolated; the field goes first. Fireflies that would touch the words are dropped.
export default function Field() {
  return (
    <section data-surface="night" style={{ position: 'relative', isolation: 'isolate', padding: 'var(--s-8) var(--s-5)', background: 'var(--bg)', color: 'var(--fg)', borderRadius: 'var(--r-3)', overflow: 'hidden' }}>
      <Fireflies seed={11} count={70} />
      <div className="sy-stack" style={{ '--gap': 'var(--s-4)', maxWidth: '30rem' } as React.CSSProperties}>
        <h2 className="sy-display sy-display--sm">Every bug leaves a light on.</h2>
        <p className="sy-text--lead">Sypnia follows it back to where it started.</p>
        <div><Button variant="primary">Start</Button></div>
      </div>
    </section>
  );
}

In Astro, on paper

<sy-fireflies> drops the ones on the words; on paper they are ink-lit.

On paper the fireflies are ink-lit; the same seed gives the same field.

Code
---
import Fireflies from '@sypnia/ui/astro/Fireflies.astro';
---
<section data-surface="paper" style="position: relative; isolation: isolate; padding: var(--s-7) var(--s-5); background: var(--bg); color: var(--fg); border-radius: var(--r-3); overflow: hidden">
  <Fireflies seed={4} count={40} />
  <p class="sy-voice" style="font-size: var(--text-xl); max-width: 26rem">On paper the fireflies are ink-lit; the same seed gives the same field.</p>
</section>

When to use it

Use it when

  • The top of a landing page or a product home, on night.
  • A celebration screen.

Do not use it when

  • Behind data, forms or reading text: it is a mood, not a background for work.
  • More than one field on a screen.

For everyone

  • The field is hidden from screen readers.
  • With reduced motion the fireflies stay still.

Props

FirefliesTypeDefault
count

How many fireflies.

number 84
seed

The same seed draws the same field.

number 11
  1. Behind a hero
  2. In Astro, on paper
  3. When to use it
  4. For everyone
  5. Props

    Search pages, sections and terms