Skip to main content

columnStyle

Description

Optional. Defines the style of a column in the table

Usage

columnStyle?: (column: IColumn) => string;

Parameters

The function takes the following parameters:

  • column - an object with the column configuration parameters. All parameters description you can find here: columns

The function returns the name of a CSS class or an empty string.

Example

import { getData } from "./common/data";
import { Grid } from "@svar-ui/react-grid";

const { data, columns } = getData();

export default function App() {
return (
<div style={{ padding: 20 }}>
<div>
<Grid
data={data}
columns={columns}
columnStyle={(col) => (col.id === 'city' ? 'columnStyle' : '')}
/>
</div>
</div>
);
}

CSS (in a separate file or global stylesheet):

.columnStyle {
text-decoration: underline;
color: rgb(231, 7, 231);
}

Related articles: columns