# Cell Format Editor

<figure><img src="https://67932947-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHWsslZpYESUXxPccoyig%2Fuploads%2Fgit-blob-5c49714df31124b0b63e9903c772ef63792fc330%2Fimage.png?alt=media" alt=""><figcaption><p>Cmd + Option + 1 will bring up the cell format editor</p></figcaption></figure>

<pre class="language-tsx" data-overflow="wrap"><code class="lang-tsx">import { CanvasGrid, defaultSpreadsheetTheme } from "@rowsncolumns/spreadsheet"
import { useSpreadsheetState, CellFormatEditor, CellFormatEditorDialog } from "@rowsncolumns/spreadsheet-state"

const App = () => {
  const activeSheetId = 1
  const [theme, onChangeTheme] = useState&#x3C;SpreadsheetTheme>(
    defaultSpreadsheetTheme
  );
<strong>  const {
</strong><strong>    activeCell,
</strong><strong>    selections,
</strong><strong>    theme,
</strong><strong>    onMergeCells,
</strong><strong>    onChangeFormatting,
</strong><strong>    onChangeBorder,
</strong><strong>    onRequestFormatCells,
</strong><strong>    getUserEnteredFormat,
</strong><strong>    getEffectiveValue
</strong><strong>  } = useSpreadsheetState({
</strong>    ...
  })
  
  const currentCellFormat = useMemo(
    () =>
      getUserEnteredFormat(
        activeSheetId,
        activeCell.rowIndex,
        activeCell.columnIndex
      ),
    [activeSheetId, activeCell, getUserEnteredFormat]
  );
  return (
    &#x3C;>
      &#x3C;CanvasGrid
        // Binds to keyboard shortcut and context menu
        onRequestFormatCells={onRequestFormatCells}
      />
      &#x3C;CellFormatEditorDialog>
        &#x3C;CellFormatEditor
          sheetId={activeSheetId}
          activeCell={activeCell}
          selections={selections}
          onChangeFormatting={onChangeFormatting}
          cellFormat={currentCellFormat}
          getEffectiveValue={getEffectiveValue}
          onMergeCells={onMergeCells}
          theme={theme}
          onChangeBorder={onChangeBorder}
        />
      &#x3C;/CellFormatEditorDialog>

    &#x3C;/>
  )
}
</code></pre>
