0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

react

Last updated at Posted at 2023-10-20
import * as React from 'react';
import { useState } from 'react';
import { Dialog, DialogType, DialogFooter, PrimaryButton } from 'office-ui-fabric-react';

const MyComponent: React.FC = () => {
  const [isDialogVisible, setIsDialogVisible] = useState(false);

  const openDialog = () => {
    setIsDialogVisible(true);
  }

  const closeDialog = () => {
    setIsDialogVisible(false);
  }

  return (
    <div>
      <a href="#" onClick={openDialog}>リンクをクリック</a>

      <Dialog
        hidden={!isDialogVisible}
        onDismiss={closeDialog}
        dialogContentProps={{
          type: DialogType.normal,
          title: 'ダイアログのタイトル',
          subText: 'ダイアログの内容をここに表示します。',
        }}
        modalProps={{
          isBlocking: false,
          styles: { main: { maxWidth: 450 } },
        }}
      >
        <DialogFooter>
          <PrimaryButton onClick={closeDialog} text="閉じる" />
        </DialogFooter>
      </Dialog>
    </div>
  );
}

export default MyComponent;


0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?