ConditionalContents variable

A toolbar primitive that allows you to show different contents based on the editor that is in focus. Useful for code editors that have different features and don't support rich text formatting.

Signature:

ConditionalContents: React.FC<ConditionalContentsProps>

Example

   <ConditionalContents
     options={[
       { when: (editor) => editor?.editorType === 'codeblock', contents: () => <ChangeCodeMirrorLanguage /> },
       { when: (editor) => editor?.editorType === 'sandpack', contents: () => <ShowSandpackInfo /> },
       {
         fallback: () => (
           <>
             <UndoRedo />
             <BoldItalicUnderlineToggles />
             <InsertCodeBlock />
           </>
         )
       }
     ]}
   />