Skip to content

Add Loading States to Action Buttons #131

@Adeswalla

Description

@Adeswalla

Description

Provide immediate visual feedback when interacting with smart contracts by rendering spinners inside the buttons.

Proposed Code Solution

import React from 'react';
import { Loader2 } from 'lucide-react';

export default function Button({ isLoading, disabled, children, ...props }) {
  return (
    <button 
      disabled={isLoading || disabled}
      className={`flex items-center justify-center px-4 py-2 bg-blue-600 font-medium text-white rounded-md transition-colors
      ${(isLoading || disabled) ? 'opacity-50 cursor-not-allowed' : 'hover:bg-blue-700'}`}
      {...props}
    >
      {isLoading && <Loader2 className="animate-spin mr-2 h-5 w-5" />}
      {children}
    </button>
  );
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrontendFrontend related issuesStellar WaveIssues in the Stellar wave program

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions