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.

fix: slides css for better centering of content (#4946)

Myles Scolnick88da1080de52
diff --git a/frontend/src/components/slides/slides-component.tsx b/frontend/src/components/slides/slides-component.tsx
index 21d1256bf7..36239a0b3e 100644
--- a/frontend/src/components/slides/slides-component.tsx
+++ b/frontend/src/components/slides/slides-component.tsx
@@ -104,8 +104,7 @@ const SlidesComponent = ({
isFullscreen ? "p-20" : "p-6",
)}
>
- {/* this centers the contents */}
- <div className="m-auto max-w-full">{child}</div>
+ <div className="mo-slide-content">{child}</div>
</div>
</SwiperSlide>
);
diff --git a/frontend/src/components/slides/slides.css b/frontend/src/components/slides/slides.css
index 7026b22391..52e20e2f25 100644
--- a/frontend/src/components/slides/slides.css
+++ b/frontend/src/components/slides/slides.css
@@ -56,3 +56,39 @@ so we are resetting this back to initial. */
:host:host {
display: initial;
}
+
+/* The slides is full width, but centers the inside content to fit the width of the content. */
+.mo-slide-content {
+ width: 100%;
+ display: flex;
+ justify-content: center;
+
+ /* width is normally set to 100%, but we want the content to be centered around
+ the width needed. */
+ .output {
+ /* center the output vertically if there is space,
+ we use flexbox to center the output horizontally */
+ margin: auto 0;
+ max-width: 100%;
+ width: unset;
+ }
+
+ /* Components that should be full width when in slides mode */
+ div:has(> marimo-ui-element > marimo-vega) {
+ display: block !important;
+ flex: 1;
+
+ @media (min-width: 500px) {
+ min-width: 350px;
+ }
+ }
+}
+
+/* helpful for debugging */
+/* .mo-slide-content {
+ background-color: red;
+
+ .output {
+ background-color: green;
+ }
+} */