Skip to content

Commit 82f1ecc

Browse files
authored
[graphiql] add className prop. Additional class names which will be appended to the GraphiQL container element (#3643)
1 parent 88c3d5a commit 82f1ecc

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

.changeset/lazy-beers-confess.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"graphiql": minor
3+
---
4+
5+
add `className` prop. Additional class names which will be appended to the GraphiQL container element

packages/graphiql/src/components/GraphiQL.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,10 @@ export type GraphiQLInterfaceProps = WriteableEditorProps &
225225
* rendered with a specific theme
226226
*/
227227
forcedTheme?: (typeof THEMES)[number];
228+
/**
229+
* Additional class names which will be appended to the container element.
230+
*/
231+
className?: string;
228232
};
229233

230234
const THEMES = ['light', 'dark', 'system'] as const;
@@ -465,9 +469,14 @@ export function GraphiQLInterface(props: GraphiQLInterfaceProps) {
465469
</Tooltip>
466470
);
467471

472+
const className = props.className ? ` ${props.className}` : '';
473+
468474
return (
469475
<Tooltip.Provider>
470-
<div data-testid="graphiql-container" className="graphiql-container">
476+
<div
477+
data-testid="graphiql-container"
478+
className={`graphiql-container${className}`}
479+
>
471480
<div className="graphiql-sidebar">
472481
<div className="graphiql-sidebar-section">
473482
{pluginContext?.plugins.map((plugin, index) => {

0 commit comments

Comments
 (0)