# table-builder-block/2.0.0/src/table-builder/save.js

TableKit – WordPress Table Builder for Data Tables, WooCommerce Product Tables &amp; Post Tables, version 2.0.0. 39 lines.

- Page: https://pluginprobe.com/plugins/table-builder-block/2.0.0/code/src/table-builder/save.js
- Raw: https://pluginprobe.com/plugins/table-builder-block/2.0.0/raw/src/table-builder/save.js
- Modified: 2024-10-06T12:14:36+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/table-builder-block/2.0.0/code/src/table-builder/save.js#L10-L20`.

```javascript
import {
	useBlockProps,
	useInnerBlocksProps,
	RichText,
} from '@wordpress/block-editor';

export default function save( { attributes } ) {
	const { caption, headers, footers, hasHeader, hasFooter, isEmpty } =
		attributes;
	const blockProps = useBlockProps.save();
	const innerBlocksProps = useInnerBlocksProps.save( {
		className: 'gkit-table__body',
	} );

	return (
		! isEmpty && (
			<figure { ...blockProps }>
				<table className="gkit-table">
					<thead className="gkit-table__header">
						<tr>{ Headers }</tr>
					</thead>
					<tbody { ...innerBlocksProps } />
					<tfoot className="gkit-table__footer">
						<tr>{ Footers }</tr>
					</tfoot>
				</table>
				{ caption && (
					<RichText.Content
						identifier="caption"
						tagName="figcaption"
						className="gkit-table__caption"
						value={ caption }
					/>
				) }
			</figure>
		)
	);
}

```
