glink
Types
pub type App(error) {
  App(exit: fn(error) -> Nil)
}
      
      Constructors
- 
          
App(exit: fn(error) -> Nil)Arguments
- exit
 - 
                
Exit (unmount) the whole Ink app.
 
 
pub type EventEmitter
      
    pub type Focus {
  Focus(is_focused: Bool, focus: fn(String) -> Nil)
}
      
      Constructors
- 
          
Focus(is_focused: Bool, focus: fn(String) -> Nil)Arguments
- is_focused
 - 
                
Determines whether this component is focused or not.
 - focus
 - 
                
Allows focusing a specific element with the provided ID.
 
 
pub type FocusManager {
  FocusManager(
    enable_focus: fn() -> Nil,
    disable_focus: fn() -> Nil,
    focus_next: fn() -> Nil,
    focus_previous: fn() -> Nil,
    focus: fn(String) -> Nil,
  )
}
      
      Constructors
- 
          
FocusManager( enable_focus: fn() -> Nil, disable_focus: fn() -> Nil, focus_next: fn() -> Nil, focus_previous: fn() -> Nil, focus: fn(String) -> Nil, )Arguments
- enable_focus
 - 
                
Enable focus management for all components.
 - disable_focus
 - 
                
Disable focus management for all components. Currently active component (if there’s one) will lose its focus.
 - focus_next
 - 
                
Switch focus to the next focusable component. If there’s no active component right now, focus will be given to the first focusable component. If active component is the last in the list of focusable components, focus will be switched to the first component.
 - focus_previous
 - 
                
Switch focus to the previous focusable component. If there’s no active component right now, focus will be given to the first focusable component. If active component is the first in the list of focusable components, focus will be switched to the last component.
 - focus
 - 
                
Switch focus to the element with provided ID. If there’s no element with that ID, focus will be given to the first focusable component.
 
 
pub type InputHandler =
  fn(String, Key) -> Nil
      
    pub type Instance(error) {
  Instance(
    rerender: fn(Component) -> Nil,
    unmount: fn(error) -> Nil,
    wait_until_exit: fn(fn() -> Nil) -> Nil,
    cleanup: fn() -> Nil,
    clear: fn() -> Nil,
  )
}
      
      Constructors
- 
          
Instance( rerender: fn(Component) -> Nil, unmount: fn(error) -> Nil, wait_until_exit: fn(fn() -> Nil) -> Nil, cleanup: fn() -> Nil, clear: fn() -> Nil, )Arguments
- rerender
 - 
                
Replace previous root node with a new one or update props of the current root node.
 - unmount
 - 
                
Manually unmount the whole Ink app.
 - wait_until_exit
 - 
                
Awaits a promise, which resolves when app is unmounted.
 - clear
 - 
                
Clear output.
 
 
pub type Key {
  Key(
    up_arrow: Bool,
    down_arrow: Bool,
    left_arrow: Bool,
    right_arrow: Bool,
    page_down: Bool,
    page_up: Bool,
    return: Bool,
    escape: Bool,
    ctrl: Bool,
    shift: Bool,
    tab: Bool,
    backspace: Bool,
    delete: Bool,
    meta: Bool,
  )
}
      
      Constructors
- 
          
Key( up_arrow: Bool, down_arrow: Bool, left_arrow: Bool, right_arrow: Bool, page_down: Bool, page_up: Bool, return: Bool, escape: Bool, ctrl: Bool, shift: Bool, tab: Bool, backspace: Bool, delete: Bool, meta: Bool, )Handy information about a key that was pressed.
Arguments
- up_arrow
 - 
                
Up arrow key was pressed.
 - down_arrow
 - 
                
Down arrow key was pressed.
 - left_arrow
 - 
                
Left arrow key was pressed.
 - right_arrow
 - 
                
Right arrow key was pressed.
 - page_down
 - 
                
Page Down key was pressed.
 - page_up
 - 
                
Page Up key was pressed.
 - return
 - 
                
Return (Enter) key was pressed.
 - escape
 - 
                
Escape key was pressed.
 - ctrl
 - 
                
Ctrl key was pressed.
 - shift
 - 
                
Shift key was pressed.
 - tab
 - 
                
Tab key was pressed.
 - backspace
 - 
                
Backspace key was pressed.
 - delete
 - 
                
Delete key was pressed.
 - meta
 - 
                
Meta key was pressed.
 
 
pub type ReadStream
      
    pub type Size {
  Size(width: Float, height: Float)
}
      
      Constructors
- 
          
Size(width: Float, height: Float)Arguments
- width
 - 
                
Element width.
 - height
 - 
                
Element height.
 
 
pub type Stderr {
  Stderr(stderr: WriteStream, write: fn(String) -> Nil)
}
      
      Constructors
- 
          
Stderr(stderr: WriteStream, write: fn(String) -> Nil)Arguments
- stderr
 - 
                
Stderr stream passed to
render()inoptions.stderrorprocess.stderrby default. NOTE: Not yet useable. - write
 - 
                
Write any string to stderr, while preserving Ink’s output. It’s useful when you want to display some external information outside of Ink’s rendering and ensure there’s no conflict between the two. It’s similar to
<Static>, except it can’t accept components, it only works with strings. 
 
pub type Stdin {
  Stdin(
    stdin: ReadStream,
    set_raw_mode: fn(Bool) -> Nil,
    is_raw_mode_supported: Bool,
    internal_exit_on_ctrl_c: Bool,
    internal_event_emitter: EventEmitter,
  )
}
      
      Constructors
- 
          
Stdin( stdin: ReadStream, set_raw_mode: fn(Bool) -> Nil, is_raw_mode_supported: Bool, internal_exit_on_ctrl_c: Bool, internal_event_emitter: EventEmitter, )Arguments
- stdin
 - 
                
Stdin stream passed to
render()inoptions.stdinorprocess.stdinby default. Useful if your app needs to handle user input. NOTE: Not yet useable. - set_raw_mode
 - 
                
Ink exposes this function via own
<StdinContext>to be able to handle Ctrl+C, that’s why you should use Ink’sset_raw_mode. If thestdinstream passed to Ink does not supportset_raw_mode, this function does nothing. - is_raw_mode_supported
 - 
                
A boolean flag determining if the current
stdinsupportsset_raw_mode. A component usingset_raw_modemight want to useis_raw_mode_supportedto nicely fall back in environments where raw mode is not supported. 
 
pub type Stdout {
  Stdout(stdout: WriteStream, write: fn(String) -> Nil)
}
      
      Constructors
- 
          
Stdout(stdout: WriteStream, write: fn(String) -> Nil)Arguments
- stdout
 - 
                
Stdout stream passed to
render()inoptions.stdoutorprocess.stdoutby default. NOTE: Not yet useable. - write
 - 
                
Write any string to stdout, while preserving Ink’s output. It’s useful when you want to display some external information outside of Ink’s rendering and ensure there’s no conflict between the two. It’s similar to
<Static>, except it can’t accept components, it only works with strings. 
 
Function which transforms children output. It accepts children and must return transformed children too.
pub type Transform =
  fn(String, Int) -> String
      
    pub type WriteStream
      
    Values
pub fn box(
  styles styles: List(Style),
  attributes attrs: List(Attribute),
  children children: List(Component),
) -> Component
    
    box is an essential Ink component to build your layout. It’s like <div style="display: flex"> in the browser.
pub fn box_(
  styles styles: List(Style),
  children children: List(Component),
) -> Component
    
    box without attributes.
pub fn measure_element(node: a) -> Size
    
    Measure the dimensions of a particular box element.
pub fn newline(count: Int) -> Component
    
    Adds one or more newline (\n) characters. Must be used within text components.
pub fn render(component: Component) -> Instance(a)
    
    Mount a component and render the output.
pub fn spacer() -> Component
    
    A flexible space that expands along the major axis of its containing layout. It’s useful as a shortcut for filling all the available spaces between elements.
pub fn static(
  items: List(a),
  styles: List(Style),
  children: fn(a, Int) -> #(String, Component),
) -> Component
    
    static component permanently renders its output above everything else.
It’s useful for displaying activity like completed tasks or logs - things that
are not changing after they’re rendered (hence the name “static”).
It’s preferred to use static for use cases like these, when you can’t know
or control the amount of items that need to be rendered.
pub fn static_(
  items: List(a),
  children: fn(a, Int) -> #(String, Component),
) -> Component
    
    static without styles.
pub fn text(
  props: List(Prop),
  children: List(Component),
) -> Component
    
    This component can display text, and change its style to make it colorful, bold, underline, italic or strikethrough.
pub fn text_(props: List(Prop), text: String) -> Component
    
    text that use a single String for its children.
pub fn text__(text: String) -> Component
    
    text without props and uses a single String for its children.
pub fn transform(
  transform: fn(String, Int) -> String,
  children: List(Component),
) -> Component
    
    Transform a string representation of React components before they are written to output.
For example, you might want to apply a gradient to text, add a clickable link or create some text effects.
These use cases can’t accept React nodes as input, they are expecting a string.
That’s what transform component does, it gives you an output string of its child components and lets you transform it in any way.
pub fn use_app() -> App(a)
    
    use_app is a React hook, which exposes a method to manually exit the app (unmount).
pub fn use_focus(props: List(Prop)) -> Focus
    
    Component that uses use_focus hook becomes “focusable” to Ink,
so when user presses Tab, Ink will switch focus to this component.
If there are multiple components that execute use_focus hook, focus will be
given to them in the order that these components are rendered in.
This hook returns an object with is_focused boolean property, which
determines if this component is focused or not.
pub fn use_focus_manager() -> FocusManager
    
    This hook exposes methods to enable or disable focus management for all components or manually switch focus to next or previous components.
pub fn use_input(
  handler: fn(String, Key) -> Nil,
  is_active: Bool,
) -> Nil
    
    This hook is used for handling user input.
It’s a more convenient alternative to using StdinContext and listening to data events.
The callback you pass to use_input is called for each character when user enters any input.
However, if user pastes text and it’s more than one character, the callback will be called only once and the whole string will be passed as input.
pub fn use_input_(handler: fn(String, Key) -> Nil) -> Nil
    
    use_input with is_active set to True.
pub fn use_stderr() -> Stderr
    
    use_stderr is a React hook, which exposes stderr stream.
pub fn use_stdout() -> Stdout
    
    use_stdout is a React hook, which exposes stdout stream.