Skip to content

Commit 98050cb

Browse files
committed
feat: add className prop to container
1 parent 19a29a6 commit 98050cb

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

src/lib/Components/GridRenderer.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,18 @@ import { ErrorBoundary } from './ErrorBoundary';
55
import { useReactGridState } from './StateProvider';
66
import { isBrowserFirefox } from '../Functions/firefox';
77

8-
export const GridRenderer: React.FC<GridRendererProps> = ({ eventHandlers, children }) => {
8+
export const GridRenderer: React.FC<GridRendererProps> = ({ eventHandlers, children, className }) => {
99
const { cellMatrix, props } = useReactGridState();
1010
const sharedStyles = {
1111
width: props?.enableFullWidthHeader ? '100%' : cellMatrix.width,
1212
height: cellMatrix.height,
1313
};
14+
const classNameJoined = ['reactgrid', className].filter(Boolean).join(' ');
15+
1416
return (
1517
<ErrorBoundary>
1618
<div
17-
className="reactgrid"
19+
className={classNameJoined}
1820
style={{
1921
position: 'relative',
2022
paddingRight: isBrowserFirefox() ? "10px" : "",

src/lib/Components/ReactGrid.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ export class ReactGrid extends React.Component<ReactGridProps, State> {
109109
}
110110

111111
render(): React.ReactNode {
112-
const { state, eventHandlers } = this;
112+
const { state, eventHandlers, props } = this;
113113

114114
if (state.legacyBrowserMode) {
115115
return (
@@ -121,7 +121,7 @@ export class ReactGrid extends React.Component<ReactGridProps, State> {
121121

122122
return (
123123
<StateProvider state={state}>
124-
<GridRenderer eventHandlers={eventHandlers}>
124+
<GridRenderer className={props.className} eventHandlers={eventHandlers}>
125125
<PanesRenderer cellRenderer={CellRenderer} />
126126

127127
<Line />

src/lib/Model/InternalModel.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ export interface PointerLocation extends Location {
5454
}
5555

5656
export interface GridRendererProps {
57+
readonly className?: string;
5758
eventHandlers: EventHandlers;
5859
}
5960

src/lib/Model/PublicModel.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ export type SelectionMode =
3333
* @see https://reactgrid.com/docs/3.1/7-api/0-interfaces/1-reactgrid-props/
3434
*/
3535
export interface ReactGridProps {
36+
/** CSS class name for the grid container */
37+
readonly className?: string;
3638
/** Array of `Column`s */
3739
readonly columns: Column[];
3840
/** Array of `Row`s */

0 commit comments

Comments
 (0)