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.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
Add a third width option, "medium", in between normal and full (#888)
Akshay Agrawal753233d2a1d5
diff --git a/frontend/src/components/app-config/app-config-form.tsx b/frontend/src/components/app-config/app-config-form.tsxindex f28062c201..a6821bd0d6 100644--- a/frontend/src/components/app-config/app-config-form.tsx+++ b/frontend/src/components/app-config/app-config-form.tsx@@ -7,11 +7,16 @@ import {FormField,FormItem,FormLabel,+ FormMessage,} from "@/components/ui/form";-import { AppConfig, AppConfigSchema } from "../../core/config/config-schema";+import {+ AppConfig,+ AppConfigSchema,+ APP_WIDTHS,+} from "../../core/config/config-schema";+import { NativeSelect } from "../ui/native-select";import { toast } from "../ui/use-toast";import { useAppConfig } from "@/core/config/config";-import { Switch } from "@/components/ui/switch";import { saveAppConfig } from "@/core/network/requests";import { SettingTitle, SettingDescription } from "./common";import { useEffect } from "react";@@ -49,23 +54,31 @@ export const AppConfigForm: React.FC = () => {><div><SettingTitle>Application Config</SettingTitle>- <SettingDescription>Settings applied to this app</SettingDescription>+ <SettingDescription>+ Settings applied to this notebook+ </SettingDescription></div><FormFieldcontrol={form.control}name="width"render={({ field }) => (- <FormItem className="flex flex-row items-center space-x-2 space-y-0">+ <FormItem>+ <FormLabel>Width</FormLabel><FormControl>- <Switch- checked={field.value === "full"}- size="sm"- onCheckedChange={(checked) => {- field.onChange(checked ? "full" : "normal");- }}- />+ <NativeSelect+ onChange={(e) => field.onChange(e.target.value)}+ value={field.value}+ disabled={field.disabled}+ className="inline-flex mx-2"+ >+ {APP_WIDTHS.map((option) => (+ <option value={option} key={option}>+ {option}+ </option>+ ))}+ </NativeSelect></FormControl>- <FormLabel className="font-normal">Full-width</FormLabel>+ <FormMessage /></FormItem>)}/>diff --git a/frontend/src/components/editor/renderers/vertical-layout/vertical-layout-wrapper.tsx b/frontend/src/components/editor/renderers/vertical-layout/vertical-layout-wrapper.tsxindex f29dac1d36..10d2d3ea03 100644--- a/frontend/src/components/editor/renderers/vertical-layout/vertical-layout-wrapper.tsx+++ b/frontend/src/components/editor/renderers/vertical-layout/vertical-layout-wrapper.tsx@@ -21,7 +21,9 @@ export const VerticalLayoutWrapper: React.FC<PropsWithChildren<Props>> = ({className={cn(// Large mobile bottom padding due to mobile browser navigation bar"m-auto pb-24 sm:pb-12",- appConfig.width !== "full" && "max-w-contentWidth min-w-[400px]",+ appConfig.width === "normal" && "max-w-contentWidth min-w-[400px]",+ appConfig.width === "medium" &&+ "max-w-contentWidthMedium min-w-[400px]",// Hide the cells for a fake loading effect, to avoid flickeringinvisible && "invisible",)}diff --git a/frontend/src/core/config/config-schema.ts b/frontend/src/core/config/config-schema.tsindex 5a724d8e0e..c2f2cf6a9f 100644--- a/frontend/src/core/config/config-schema.ts+++ b/frontend/src/core/config/config-schema.ts@@ -92,9 +92,10 @@ export type SaveConfig = UserConfig["save"];export type CompletionConfig = UserConfig["completion"];export type KeymapConfig = UserConfig["keymap"];+export const APP_WIDTHS = ["normal", "medium", "full"] as const;export const AppConfigSchema = z.object({- width: z.enum(["full", "normal"]).default("normal"),+ width: z.enum(APP_WIDTHS).default("normal"),}).default({ width: "normal" });export type AppConfig = z.infer<typeof AppConfigSchema>;diff --git a/frontend/src/css/App.css b/frontend/src/css/App.cssindex 1dbc2374e3..3d7cf0b854 100644--- a/frontend/src/css/App.css+++ b/frontend/src/css/App.css@@ -20,6 +20,7 @@ html {:root {--content-width: 740px;+ --content-width-medium: 1110px;--monospace-font: "Fira Mono";--text-font: "PT Sans", sans-serif;--heading-font: "Lora", serif;diff --git a/frontend/tailwind.config.js b/frontend/tailwind.config.jsindex 374fdae067..18c5c114cb 100644--- a/frontend/tailwind.config.js+++ b/frontend/tailwind.config.js@@ -46,6 +46,7 @@ module.exports = {},maxWidth: {contentWidth: "var(--content-width)",+ contentWidthMedium: "var(--content-width-medium)",},padding: {18: "4.5rem",diff --git a/marimo/_ast/app.py b/marimo/_ast/app.pyindex db96ce9547..59ab8191a0 100644--- a/marimo/_ast/app.py+++ b/marimo/_ast/app.py@@ -41,7 +41,7 @@ class _AppConfig:a single marimo program."""- width: Literal["normal", "full"] = "normal"+ width: Literal["normal", "medium", "full"] = "normal"# The file path of the layout file, relative to the app file.layout_file: Optional[str] = None