Skip to content

Commit

Permalink
[React] add props for button title to change the text (#422)
Browse files Browse the repository at this point in the history
Co-authored-by: Jonas Daniels <jonas.daniels@outlook.com>
  • Loading branch information
yehia67 and jnsdls committed Dec 8, 2022
1 parent cbf5508 commit 08d04fe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/sharp-ducks-attack.md
@@ -0,0 +1,5 @@
---
"@thirdweb-dev/react": patch
---

Add `btnTitle` prop to the `ConnectWallet` component. Now you can set customized string or child component to the connect button.
6 changes: 5 additions & 1 deletion packages/react/src/evm/components/ConnectWallet/index.tsx
Expand Up @@ -63,6 +63,7 @@ interface ConnectWalletProps extends ThemeProviderProps {
loginOptional?: boolean;
};
className?: string;
btnTitle?: JSX.Element | string;
}

let connecting = false;
Expand Down Expand Up @@ -120,6 +121,7 @@ const chainIdToCurrencyMap: Record<
export const ConnectWallet: React.FC<ConnectWalletProps> = ({
auth,
className,
btnTitle,
...themeProps
}) => {
const id = useId();
Expand Down Expand Up @@ -248,7 +250,9 @@ export const ConnectWallet: React.FC<ConnectWalletProps> = ({
</span>
)
) : (
<span style={{ whiteSpace: "nowrap" }}>Connect Wallet</span>
<span style={{ whiteSpace: "nowrap" }}>
{btnTitle || "Connect Wallet"}
</span>
)}
</Button>

Expand Down

0 comments on commit 08d04fe

Please sign in to comment.