()
| 1 | import { useXTerm } from 'react-xtermjs' |
| 2 | |
| 3 | function App() { |
| 4 | const { instance, ref } = useXTerm() |
| 5 | instance?.writeln('Hello from react-xtermjs!') |
| 6 | instance?.onData((data) => instance?.write(data)) |
| 7 | |
| 8 | return ( |
| 9 | <div className="flex flex-col gap-5 bg-gray-100 p-14 min-h-screen"> |
| 10 | <button |
| 11 | type="button" |
| 12 | onClick={() => instance?.reset()} |
| 13 | className="transition-colors text-white hover:bg-gray-800 bg-gray-900 focus:outline-none focus:ring-2 focus:ring-gray-300 tracking-wide rounded-lg text-sm px-5 py-2.5 max-w-fit mx-auto" |
| 14 | > |
| 15 | Clear terminal |
| 16 | </button> |
| 17 | <div className="p-3 rounded overflow-hidden border border-gray-300 shadow-lg"> |
| 18 | <div ref={ref} /> |
| 19 | </div> |
| 20 | </div> |
| 21 | ) |
| 22 | } |
| 23 | |
| 24 | export default App |
nothing calls this directly
no test coverage detected