Skip to main content

Run Bluefish

Welcome to the Bluefish documentation! This page will show you how to run Bluefish if you just want to get started coding. If you want to learn more about Bluefish, check out our tutorial.

If you just want to play around with Bluefish, feel free to edit or fork the sandbox below!

(Hint: Try changing the spacing between the planets.)

import { Bluefish, Group, StackH, StackV, Circle, Text, Ref, Background, Arrow, Align, Distribute, Rect } from "@bluefish-js/solid";

const App = () => {
  return (
      {/* Bluefish is a diagramming library for SolidJS */}
      {/* You can specify UI-like components such as Row and Background */}
      <Background padding={20}>
        <StackH spacing={50}>
          <Circle name="mercury" r={15} fill="#EBE3CF" stroke-width={3} stroke="black" />
          <Circle r={36} fill="#DC933C" stroke-width={3} stroke="black" />
          <Circle r={38} fill="#179DD7" stroke-width={3} stroke="black" />
          <Circle r={21} fill="#F1CF8E" stroke-width={3} stroke="black" />
      {/* But you can also use *relations* like Align and Distribute */}
      <Align alignment="centerX">
        <Text name="label">Mercury</Text>
        {/* Bluefish lets you refer to previous components using a special `Ref` component. */}
        <Ref select="mercury" />
      <Distribute direction="vertical" spacing={60}>
        <Ref select="label" />
        <Ref select="mercury" />
      {/* In addition to performing layout, Bluefish relations can also draw objects. */}
        <Ref select="label" />
        <Ref select="mercury" />

export default App;

Run Bluefish on Other Platforms

In other environments, you can still use Bluefish, but without the SolidJS compiler and JSX syntax. Bluefish components can be used in these environments under the exported Hyperscript namespace.

For simple diagrams, the Hyperscript API isn't too different from JSX. For more advanced uses, read about the differences.


Here's a starter notebook:


Here's a starter REPL:

Install Bluefish Locally

Bluefish is built on SolidJS and works best in that environment. But it can be used in other environments, too.

Create a New SolidJS Project

Follow these steps to create a new project:

Add to an Existing SolidJS Project

To add Bluefish to an existing SolidJS project, you can install it with your favorite package manager.

npm install @bluefish-js/solid