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.

hide add cell toolbar when show-chrome is false (#9487)

Shahmir Varqha5838cf2cf35a
diff --git a/docs/guides/publishing/playground.md b/docs/guides/publishing/playground.md
index 4c82d7a5c1..b6ff204af1 100644
--- a/docs/guides/publishing/playground.md
+++ b/docs/guides/publishing/playground.md
@@ -199,8 +199,9 @@ providing your users with an interactive code playground.
??? note "Showing editor controls"
- To show editor controls (such as panels icons and the run button), use
- the query parameter `show-chrome=true`
+ To show editor controls (such as panels icons, the run button, and the
+ add-cell toolbar at the bottom of each column), use the query parameter
+ `show-chrome=true`.
### Embedding an existing notebook
diff --git a/frontend/src/components/editor/renderers/cell-array.tsx b/frontend/src/components/editor/renderers/cell-array.tsx
index 29d3aee9a5..8501c22fce 100644
--- a/frontend/src/components/editor/renderers/cell-array.tsx
+++ b/frontend/src/components/editor/renderers/cell-array.tsx
@@ -59,6 +59,7 @@ interface CellArrayProps {
mode: AppMode;
userConfig: UserConfig;
appConfig: AppConfig;
+ hideControls?: boolean;
}
export const CellArray: React.FC<CellArrayProps> = (props) => {
@@ -82,6 +83,7 @@ const CellArrayInternal: React.FC<CellArrayProps> = ({
mode,
userConfig,
appConfig,
+ hideControls = false,
}) => {
const actions = useCellActions();
const { theme } = useTheme();
@@ -147,6 +149,7 @@ const CellArrayInternal: React.FC<CellArrayProps> = ({
mode={mode}
userConfig={userConfig}
theme={theme}
+ hideControls={hideControls}
/>
))}
</div>
@@ -166,6 +169,7 @@ const CellColumn: React.FC<{
mode: AppMode;
userConfig: UserConfig;
theme: Theme;
+ hideControls: boolean;
}> = ({
columnId,
index,
@@ -174,6 +178,7 @@ const CellColumn: React.FC<{
mode,
userConfig,
theme,
+ hideControls,
}) => {
const cellIds = useCellIds();
const column = cellIds.get(columnId);
@@ -191,13 +196,15 @@ const CellColumn: React.FC<{
width={appConfig.width}
canDelete={columnsLength > 1}
footer={
- <AddCellButtons
- columnId={columnId}
- className={cn(
- appConfig.width === "columns" &&
- "opacity-0 group-hover/column:opacity-100",
- )}
- />
+ hideControls ? null : (
+ <AddCellButtons
+ columnId={columnId}
+ className={cn(
+ appConfig.width === "columns" &&
+ "opacity-0 group-hover/column:opacity-100",
+ )}
+ />
+ )
}
>
<SortableContext
diff --git a/frontend/src/core/edit-app.tsx b/frontend/src/core/edit-app.tsx
index ee0a3dfd80..968bd85045 100644
--- a/frontend/src/core/edit-app.tsx
+++ b/frontend/src/core/edit-app.tsx
@@ -137,6 +137,7 @@ export const EditApp: React.FC<AppProps> = ({
mode={viewState.mode}
userConfig={userConfig}
appConfig={appConfig}
+ hideControls={hideControls}
/>
);