Skip to content

Commit 5838cf2

Browse files
authored
hide add cell toolbar when show-chrome is false (#9487)
## 📝 Summary <!-- If this PR closes any issues, list them here by number (e.g., Closes #123). Detail the specific changes made in this pull request. Explain the problem addressed and how it was resolved. If applicable, provide before and after comparisons, screenshots, or any relevant details to help reviewers understand the changes easily. --> Closes #9429. Hides the Add cells buttons ## 📋 Pre-Review Checklist <!-- These checks need to be completed before a PR is reviewed --> - [ ] For large changes, or changes that affect the public API: this change was discussed or approved through an issue, on [Discord](https://marimo.io/discord?ref=pr), or the community [discussions](https://github.com/marimo-team/marimo/discussions) (Please provide a link if applicable). - [ ] Any AI generated code has been reviewed line-by-line by the human PR author, who stands by it. - [x] Video or media evidence is provided for any visual changes (optional). <!-- PR is more likely to be merged if evidence is provided for changes made --> ## ✅ Merge Checklist - [x] I have read the [contributor guidelines](https://github.com/marimo-team/marimo/blob/main/CONTRIBUTING.md). - [ ] Documentation has been updated where applicable, including docstrings for API changes. - [ ] Tests have been added for the changes made.
1 parent 70b7643 commit 5838cf2

3 files changed

Lines changed: 18 additions & 9 deletions

File tree

docs/guides/publishing/playground.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,9 @@ providing your users with an interactive code playground.
199199

200200
??? note "Showing editor controls"
201201

202-
To show editor controls (such as panels icons and the run button), use
203-
the query parameter `show-chrome=true`
202+
To show editor controls (such as panels icons, the run button, and the
203+
add-cell toolbar at the bottom of each column), use the query parameter
204+
`show-chrome=true`.
204205

205206
### Embedding an existing notebook
206207

frontend/src/components/editor/renderers/cell-array.tsx

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ interface CellArrayProps {
5959
mode: AppMode;
6060
userConfig: UserConfig;
6161
appConfig: AppConfig;
62+
hideControls?: boolean;
6263
}
6364

6465
export const CellArray: React.FC<CellArrayProps> = (props) => {
@@ -82,6 +83,7 @@ const CellArrayInternal: React.FC<CellArrayProps> = ({
8283
mode,
8384
userConfig,
8485
appConfig,
86+
hideControls = false,
8587
}) => {
8688
const actions = useCellActions();
8789
const { theme } = useTheme();
@@ -147,6 +149,7 @@ const CellArrayInternal: React.FC<CellArrayProps> = ({
147149
mode={mode}
148150
userConfig={userConfig}
149151
theme={theme}
152+
hideControls={hideControls}
150153
/>
151154
))}
152155
</div>
@@ -166,6 +169,7 @@ const CellColumn: React.FC<{
166169
mode: AppMode;
167170
userConfig: UserConfig;
168171
theme: Theme;
172+
hideControls: boolean;
169173
}> = ({
170174
columnId,
171175
index,
@@ -174,6 +178,7 @@ const CellColumn: React.FC<{
174178
mode,
175179
userConfig,
176180
theme,
181+
hideControls,
177182
}) => {
178183
const cellIds = useCellIds();
179184
const column = cellIds.get(columnId);
@@ -191,13 +196,15 @@ const CellColumn: React.FC<{
191196
width={appConfig.width}
192197
canDelete={columnsLength > 1}
193198
footer={
194-
<AddCellButtons
195-
columnId={columnId}
196-
className={cn(
197-
appConfig.width === "columns" &&
198-
"opacity-0 group-hover/column:opacity-100",
199-
)}
200-
/>
199+
hideControls ? null : (
200+
<AddCellButtons
201+
columnId={columnId}
202+
className={cn(
203+
appConfig.width === "columns" &&
204+
"opacity-0 group-hover/column:opacity-100",
205+
)}
206+
/>
207+
)
201208
}
202209
>
203210
<SortableContext

frontend/src/core/edit-app.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ export const EditApp: React.FC<AppProps> = ({
137137
mode={viewState.mode}
138138
userConfig={userConfig}
139139
appConfig={appConfig}
140+
hideControls={hideControls}
140141
/>
141142
);
142143

0 commit comments

Comments
 (0)