Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

2.5 KB
Raw Blame
/* Copyright 2026 Marimo. All rights reserved. */

import type { Meta, StoryFn } from "@storybook/react-vite";
import { StatComponent } from "@/plugins/layout/StatPlugin";

const meta: Meta<typeof StatComponent> = {
  title: "Stat",
  component: StatComponent,
  args: {},
};

export default meta;

const Template: StoryFn<typeof StatComponent> = (args) => (
  <div className="max-w-4xl">
    <StatComponent {...args} />
  </div>
);

export const Full = Template.bind({});
Full.args = {
  label: "Revenue",
  value: "$80,000",
  caption: "Last 30 days",
};

export const Increase = Template.bind({});
Increase.args = {
  label: "Revenue",
  value: "$80,000",
  caption: "+42%",
  direction: "increase",
};

export const Decrease = Template.bind({});
Decrease.args = {
  label: "Churn",
  value: "6.4%",
  caption: "-4%",
  direction: "decrease",
};

export const Bordered = Template.bind({});
Bordered.args = {
  label: "Revenue",
  value: "$80,000",
  caption: "Last 30 days",
  bordered: true,
};

export const Grid = () => {
  return (
    <div className="grid grid-cols-4 gap-4">
      <StatComponent
        label="Revenue"
        value="$80,000"
        caption="Last 30 days"
        bordered={true}
      />
      <StatComponent
        label="Profit"
        value="$30,000"
        caption="Last 30 days"
        bordered={true}
      />
      <StatComponent
        label="Marketing Spend"
        value="$10,000"
        caption="+42%"
        direction="increase"
        bordered={true}
      />
      <StatComponent
        label="Churn"
        value="6.4%"
        caption="-4%"
        direction="decrease"
        bordered={true}
      />
    </div>
  );
};

export const Flex = () => {
  return (
    <div className="flex flex-row gap-4">
      <div className="flex-1">
        <StatComponent
          label="Revenue"
          value="$80,000"
          caption="Last 30 days"
          bordered={true}
        />
      </div>
      <div className="flex-1">
        <StatComponent
          label="Profit"
          value="$30,000"
          caption="Last 30 days"
          bordered={true}
        />
      </div>
      <div className="flex-1">
        <StatComponent
          label="Marketing Spend"
          value="$10,000"
          caption="+42%"
          direction="increase"
          bordered={true}
        />
      </div>
      <div className="flex-1">
        <StatComponent
          label="Churn"
          value="6.4%"
          caption="-4%"
          direction="decrease"
          bordered={true}
        />
      </div>
    </div>
  );
};