shadcn.io is not affiliated with official shadcn/ui
Liquidity Pool Web3 Block for Radix UI
A liquidity range picker for a QBK and USDC pool: a 32-bar depth histogram, a two-thumb price range slider, the derived depth share, capital efficiency and fees a day, and positions you can add to or remove from.
Installation
Overview
Choose a price range for liquidity and see what it does, with this liquidity pool panel for React with Radix UI. It's Basinwell, a sample pool manager, and the prices, depth and volume are typed samples, not market data. A histogram of 32 bars shows how much liquidity the pool holds around the current price of 2.40, and a two-thumb Slider under it sets the minimum and maximum price; the bars inside the range turn solid and a word says In range or Out of range. The side cell derives the share of the pool's depth you cover, the capital efficiency of the range and the estimated fees a day while the price stays inside, and holds a Toggle Group for Add or Remove and for 25, 50 or 100 percent. Positions are rows you can pick, each with its range, a status word and the fees earned. The Shine Button changes them in this tab only. For liquidity managers, pool dashboards and DeFi education.
FAQ
What does the range change?
A narrower range puts the same money to work over fewer prices, so it earns a larger share of the fees while the price is inside it and nothing once the price leaves. The panel draws that as solid bars against faded ones and says In range or Out of range in words, so the state never relies on a shade alone.
How are the efficiency and the fees worked out?
Capital efficiency is 1 divided by 1 minus the fourth root of the minimum price over the maximum price. Your share of the working liquidity is your amount times that factor over the pool's active liquidity plus the same, and the fees a day are that share of a typed daily volume times a 0.30% fee tier, zero when the current price is outside the range. These are the standard concentrated liquidity shapes on sample numbers.
What stays local, and how do I wire it?
Everything. Add and Remove change the positions list and the wallet figure in the page's state and nothing is sent to a chain. In your app read the pool's liquidity by price tick from your indexer, the user's positions from the position manager contract, and send mint and burn calls as signed transactions after a confirmation step.
Why do some actions refuse?
The demo holds four positions at most and a wallet of 10,000 USD, so a fifth add or an add with an empty wallet is answered in the status line instead of being ignored. Remove takes a share of the position you picked in the list and leaves a position at zero value rather than deleting the row.