Skip to content

Domain Widget

The DomainProfileWidget is a React component that displays a .night domain’s profile, including avatar, bio, social links, and resolved addresses.

Terminal window
npm install @midnames/sdk
import { DomainProfileWidget } from "@midnames/sdk/react/DomainProfileWidget";
import "@midnames/sdk/styles.css";
function App() {
return <DomainProfileWidget fullDomain="facu.night" />;
}
PropTypeDescription
fullDomainstringThe .night domain to display
PropTypeDefaultDescription
publicDataProviderPublicDataProviderauto (mainnet)Custom data provider
variant'full' | 'compact' | 'inline' | 'minimal''full'Layout variant
theme'light' | 'dark' | 'auto''auto'Color theme
showBannerbooleantrueShow banner image
showAvatarbooleantrueShow avatar
showBiobooleantrueShow bio text
showDomainInfobooleantrueShow address fields
showSocialLinksbooleantrueShow social link chips
showCopyButtonsbooleantrueShow copy-to-clipboard on addresses
showStatusbooleantrueShow registration status badge
fields('target' | 'owner')[]['target', 'owner']Which address fields to display
customFieldsstring[][]Additional domain fields to display
borderRadius'none' | 'sm' | 'md' | 'lg''md'Card border radius
padding'none' | 'sm' | 'md' | 'lg''md'Card padding
classNamestringAdditional CSS class
renderActions(data: DomainProfileData | null) => ReactNodeRender custom actions below the profile
onError(error: MidnamesError) => voidError callback
onFieldClick(field: string, value: string) => voidField click callback
onCopySuccess(field: string, value: string) => voidCopy success callback
<DomainProfileWidget
fullDomain="facu.night"
variant="compact"
theme="dark"
/>
<DomainProfileWidget
fullDomain="facu.night"
variant="minimal"
fields={["target"]}
showBanner={false}
showSocialLinks={false}
/>
<DomainProfileWidget
fullDomain="facu.night"
customFields={["website", "github"]}
onCopySuccess={(field, value) => {
console.log(`Copied ${field}: ${value}`);
}}
onError={(err) => {
console.error("Widget error:", err.code, err.message);
}}
/>
<DomainProfileWidget
fullDomain="facu.night"
renderActions={(data) => (
<button onClick={() => window.open(`https://midnight.domains/${data?.fullDomain}`)}>
View on Midnight Domains
</button>
)}
/>

An interactive card component that fetches domain profile data and renders it with a holographic tilt/shine effect.

import { HolographicCard } from "@midnames/sdk/react/HolographicCard";
import "@midnames/sdk/holographic-card.css";
function App() {
return <HolographicCard domain="facu.night" />;
}
PropTypeDescription
domainstringThe .night domain to display
PropTypeDefaultDescription
publicDataProviderPublicDataProviderauto (mainnet)Custom data provider
showUserInfobooleantrueShow avatar, name, and bio
enableTiltbooleantrueEnable mouse-tracking tilt effect
enableMobileTiltbooleanfalseEnable device-orientation tilt on mobile
mobileTiltSensitivitynumber5Degrees of tilt per unit of device rotation
behindGradientstringholographic defaultCSS gradient rendered behind the card
innerGradientstringlinear-gradient(145deg, ...)CSS gradient for the card face
showBehindGradientbooleantrueShow the behind gradient layer
contactTextstring"Contact"Label for the contact action button
classNamestringAdditional CSS class on the card wrapper
onContactClick() => voidCalled when the contact button is clicked
onError(error: MidnamesError) => voidError callback
<HolographicCard
domain="facu.night"
behindGradient="radial-gradient(circle at 50% 50%, #22d3ee44 0%, transparent 70%)"
contactText="Send message"
onContactClick={() => console.log("contact clicked")}
/>