Skip to content

An open source design system that's fully customizable and agent ready

TypeScript
691 B
Raw Blame
// Copyright (c) Meta Platforms, Inc. and affiliates.

'use client';

import {useState} from 'react';
import {AlertDialog} from '@astryxdesign/core/AlertDialog';

export default function AlertDialogAsyncAction() {
  const [isLoading, setIsLoading] = useState(false);

  return (
    <AlertDialog
      isOpen
      isInline
      onOpenChange={() => {}}
      title="Revoke access?"
      description="This user will immediately lose access to all shared resources."
      actionLabel="Revoke"
      isActionLoading={isLoading}
      onAction={async () => {
        setIsLoading(true);
        await new Promise(r => setTimeout(r, 2000));
        setIsLoading(false);
      }}
    />
  );
}