near-react-dao-voter
v1.0.0
Published
npm Package - @near-react/dao-voter
Readme
near-react-dao-voter
A React component for viewing and voting on NEAR DAO proposals.
Installation
npm install near-react-dao-voter
Usage
import { NearReactDaoVoter } from 'near-react-dao-voter'
function App() { return ( <NearReactDaoVoter daoContractId="mydao.sputnik-dao.near" proposalId={42} accountId="alice.near" onVote={(proposalId, vote) => console.log(proposalId, vote)} theme="light" /> ) }
Props
| Prop | Type | Required | Description |
|------|------|----------|-------------|
| daoContractId | string | ✅ | The NEAR DAO contract ID |
| proposalId | number | No | ID of the proposal to display |
| accountId | string | No | NEAR account ID of the voter |
| onVote | (proposalId: number, vote: 'Approve' \| 'Reject' \| 'Remove') => void | No | Callback fired when a vote is cast |
| theme | 'light' \| 'dark' | No | Color theme (default: 'light') |
| className | string | No | Custom CSS class |
| style | React.CSSProperties | No | Inline styles |
Types
interface DaoProposal { id: number description: string status: string votes: { approve: number reject: number remove: number } }
License
MIT
